mirror of https://gitee.com/bigwinds/arangodb
attempt to speed up dumper
This commit is contained in:
parent
e3b7be5c7a
commit
5be32e9fe5
|
@ -152,11 +152,11 @@ void RestBaseHandler::writeResult(arangodb::velocypack::Slice const& slice,
|
||||||
|
|
||||||
_response->setContentType(HttpResponse::CONTENT_TYPE_JSON);
|
_response->setContentType(HttpResponse::CONTENT_TYPE_JSON);
|
||||||
try {
|
try {
|
||||||
//arangodb::basics::VelocyPackDumper dumper(&(_response->body()), &options);
|
arangodb::basics::VelocyPackDumper dumper(&(_response->body()), &options);
|
||||||
//dumper.dumpValue(slice);
|
dumper.dumpValue(slice);
|
||||||
VPackStringBufferAdapter buffer(_response->body().stringBuffer());
|
//VPackStringBufferAdapter buffer(_response->body().stringBuffer());
|
||||||
VPackDumper dumper(&buffer, &options);
|
//VPackDumper dumper(&buffer, &options);
|
||||||
dumper.dump(slice);
|
//dumper.dump(slice);
|
||||||
} catch (std::exception const& ex) {
|
} catch (std::exception const& ex) {
|
||||||
generateError(GeneralResponse::ResponseCode::SERVER_ERROR, TRI_ERROR_INTERNAL, ex.what());
|
generateError(GeneralResponse::ResponseCode::SERVER_ERROR, TRI_ERROR_INTERNAL, ex.what());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
|
@ -425,14 +425,7 @@ void VelocyPackDumper::dumpValue(VPackSlice const* slice, VPackSlice const* base
|
||||||
case VPackValueType::String: {
|
case VPackValueType::String: {
|
||||||
VPackValueLength len;
|
VPackValueLength len;
|
||||||
char const* p = slice->getString(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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue