perf: remove one call to push in copy-from transform loop

This commit is contained in:
jeromew
2019-03-20 09:21:28 +00:00
parent 98d8d8a8e0
commit cffae659b8
2 changed files with 4 additions and 4 deletions
+2 -4
View File
@@ -30,12 +30,10 @@ CopyStreamQuery.prototype.submit = function(connection) {
}
var copyDataBuffer = Buffer.from([code.CopyData])
CopyStreamQuery.prototype._transform = function(chunk, enc, cb) {
var Int32Len = 4;
this.push(copyDataBuffer)
var lenBuffer = Buffer.alloc(Int32Len)
lenBuffer.writeUInt32BE(chunk.length + Int32Len, 0)
var lenBuffer = Buffer.from([code.CopyData, 0, 0, 0, 0])
lenBuffer.writeUInt32BE(chunk.length + Int32Len, 1)
this.push(lenBuffer)
this.push(chunk)
cb()