1
0
Fork 0

attempt to speed up dumper

This commit is contained in:
jsteemann 2016-05-12 16:46:52 +02:00
parent e3b7be5c7a
commit 5be32e9fe5
2 changed files with 6 additions and 13 deletions

View File

@ -152,11 +152,11 @@ void RestBaseHandler::writeResult(arangodb::velocypack::Slice const& slice,
_response->setContentType(HttpResponse::CONTENT_TYPE_JSON);
try {
//arangodb::basics::VelocyPackDumper dumper(&(_response->body()), &options);
//dumper.dumpValue(slice);
VPackStringBufferAdapter buffer(_response->body().stringBuffer());
VPackDumper dumper(&buffer, &options);
dumper.dump(slice);
arangodb::basics::VelocyPackDumper dumper(&(_response->body()), &options);
dumper.dumpValue(slice);
//VPackStringBufferAdapter buffer(_response->body().stringBuffer());
//VPackDumper dumper(&buffer, &options);
//dumper.dump(slice);
} catch (std::exception const& ex) {
generateError(GeneralResponse::ResponseCode::SERVER_ERROR, TRI_ERROR_INTERNAL, ex.what());
} catch (...) {

View File

@ -425,14 +425,7 @@ void VelocyPackDumper::dumpValue(VPackSlice const* slice, VPackSlice const* base
case VPackValueType::String: {
VPackValueLength len;
char const* p = slice->getString(len);
if (len == 0) {
int res = TRI_AppendString2StringBuffer(buffer, "\"\"", 2);
if (res != TRI_ERROR_NO_ERROR) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
}
} else {
appendString(p, len);
}
appendString(p, len);
break;
}