Skip to content

Commit b38eaba

Browse files
xaviergonzmbroadst
authored andcommitted
refactor(serialization): remove extra copy in serializeWithBufferAndIndex
1 parent 88f66d0 commit b38eaba

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/bson/bson.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,14 @@ BSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, optio
9393

9494
// Attempt to serialize
9595
var serializationIndex = serializer(
96-
buffer,
96+
finalBuffer,
9797
object,
9898
checkKeys,
9999
0,
100100
0,
101101
serializeFunctions,
102102
ignoreUndefined
103103
);
104-
buffer.copy(finalBuffer, startIndex, 0, serializationIndex);
105104

106105
// Return the index
107106
return startIndex + serializationIndex - 1;

0 commit comments

Comments
 (0)