buffer: little improve for Buffer.concat method#1437
Closed
JacksonTian wants to merge 1 commit intonodejs:v1.xfrom
Closed
buffer: little improve for Buffer.concat method#1437JacksonTian wants to merge 1 commit intonodejs:v1.xfrom
JacksonTian wants to merge 1 commit intonodejs:v1.xfrom
Conversation
When buffer list less than 2, no need to calculate the length. The change's benchmark result is here: https://gist.github.com/JacksonTian/2c9e2bdec00018e010e6 It improve 15% ~ 25% speed when list only have one buffer, to other cases no effect.
Contributor
There was a problem hiding this comment.
By the way, should we follow the below assertions:
assert.equal(Buffer.cancat(anyArray, len).length, len);
however
assert.equal(Buffer.cancat([], 1).length, 1); // this line would fail
assert.equal(Buffer.concat([new Buffer(20)]).length, 10); this line would fail as well and importantly i think we need to cut the buffer to 10.
@JacksonTian I know this should not be related to your patch, but it would be great if this is able to be fixed(bug? unsure) :p though cc @trevnorris
Contributor
There was a problem hiding this comment.
Thanks @yorkie for bringing that up. Let's address that issue in another PR and keep this one simple.
Contributor
|
LGTM |
Contributor
|
LGTM. Thanks. |
brendanashworth
pushed a commit
that referenced
this pull request
Apr 23, 2015
When buffer list less than 2, no need to calculate the length. The change's benchmark result is here: https://gist.github.com/JacksonTian/2c9e2bdec00018e010e6 It improve 15% ~ 25% speed when list only have one buffer, to other cases no effect. PR-URL: #1437 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
Contributor
|
LGTM. Thanks @JacksonTian, merged in |
Fishrock123
pushed a commit
to Fishrock123/node
that referenced
this pull request
May 19, 2015
When buffer list less than 2, no need to calculate the length. The change's benchmark result is here: https://gist.github.com/JacksonTian/2c9e2bdec00018e010e6 It improve 15% ~ 25% speed when list only have one buffer, to other cases no effect. PR-URL: nodejs#1437 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When buffer list less than 2, no need to calculate the length.
The change's benchmark result is here:
https://gist.github.com/JacksonTian/2c9e2bdec00018e010e6
It improve 15% ~ 25% speed when list only have one buffer,
to other cases no effect.