1
0
Fork 0

Use a BuilderLeaser in VertexIdToData

This commit is contained in:
Michael Hackstein 2016-05-02 15:50:20 +02:00
parent 5e4667969a
commit e0850c1313
1 changed files with 5 additions and 7 deletions

View File

@ -1703,17 +1703,15 @@ static void JS_ThrowCollectionNotLoaded(
static v8::Handle<v8::Value> VertexIdToData(v8::Isolate* isolate, static v8::Handle<v8::Value> VertexIdToData(v8::Isolate* isolate,
Transaction* trx, Transaction* trx,
std::string const& vertexId) { std::string const& vertexId) {
OperationOptions options;
size_t pos = vertexId.find('/'); size_t pos = vertexId.find('/');
TRI_ASSERT(pos != std::string::npos); // All are internal _id attributes TRI_ASSERT(pos != std::string::npos); // All are internal _id attributes
VPackBuilder builder; TransactionBuilderLeaser builder(trx);
builder.openObject(); builder->openObject();
builder.add(StaticStrings::KeyString, VPackValue(vertexId.substr(pos + 1))); builder->add(StaticStrings::KeyString, VPackValue(vertexId.substr(pos + 1)));
builder.close(); builder->close();
// TODO Operation Result is very expensive find a faster alternative OperationResult opRes = trx->document(vertexId.substr(0, pos), builder->slice(), options);
OperationResult opRes = trx->document(vertexId.substr(0, pos), builder.slice(), options);
if (opRes.failed()) { if (opRes.failed()) {
v8::EscapableHandleScope scope(isolate); v8::EscapableHandleScope scope(isolate);