| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Just wondering why no var here. Looks like it was there previously 2ac47f8. At this point since its a jslint error all I can think of is that we have tightened up the lint rules ?
Sorry, something went wrong.
There was a problem hiding this comment.
So this was to address a lint issue.
Really the var i in the for loop before should be declared outside of the if statement, so have added another commit to fix this,
Sorry, something went wrong.
Sorry, something went wrong.
|
Can you include specific information about the regression in the commit message? I'm not sure if this is testable, but in the future when a developer wants to reintroduce let it will be helpful to clearly understand why this was reverted. Also include a Ref: to the benchmarking issue referenced in the OP. Code change LGTM. |
Sorry, something went wrong.
|
Lgtm |
Sorry, something went wrong.
|
nit: The two commits should be squash, and the commit message should be wrapped to 72 characters (currently the first lint in the comment is 73) otherwise LGTM |
Sorry, something went wrong.
Using let in for loops showed a regression in 4.4.0. @ofrobots suggested that we avoid using let in for loops until TurboFan becomes the default optimiser. The regression that was detected was when looking at how long it took to create a new buffer from an array of data. When using `for (let i=0; i<length; i++) ` we saw the operation take almost 40% longer compared to `var i=0`. Ref: http://github.com/nodejs/benchmarking/issues/38
|
Have squashed the commits and expanded commit message. |
Sorry, something went wrong.
|
👍 |
Sorry, something went wrong.
|
excellent thanks |
Sorry, something went wrong.
|
Isn't it let usage in general and not just loops? There's a let in .toString() that could easily change to var. |
Sorry, something went wrong.
|
@mscdex perhaps we should open another issue regarding no longer using let in the code base... there are quite a few lets (including others in for loops). The biggest push back I saw what that it is a micro optimization for non-hot code Thoughts? |
Sorry, something went wrong.
|
I just did a quick test, similar to the benchmark I ran originally, but this time looking at .toString I got two builds, one with var result; and the second with let result; first of all, with let *var_tostring/Release/node to-string-test/to-string-test.js * The amount the results are bouncing around, I'd suggest that the two are performing the same. My benchmark, was measuring how many operations /second I could get when repeating this: var TEXT = "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.";
var ITERATIONS = 200000;
var buffer = new Buffer(TEXT, 'utf-8');
var stringFromBuffer;
function test() {
for(var i=0;i<ITERATIONS;i++) {
stringFromBuffer = buffer.toString();
}
}
harness.run_test(test); |
Sorry, something went wrong.
|
LGTM, new CI: https://ci.nodejs.org/job/node-test-pull-request/2038 |
Sorry, something went wrong.
|
ok looks like we have a number of lgtm. @benjamingr you planning to land ? If not I can look at doing it later today |
Sorry, something went wrong.
|
Sure, I'll land. |
Sorry, something went wrong.
Using let in for loops showed a regression in 4.4.0. @ofrobots suggested that we avoid using let in for loops until TurboFan becomes the default optimiser. The regression that was detected was when looking at how long it took to create a new buffer from an array of data. When using `for (let i=0; i<length; i++) ` we saw the operation take almost 40% longer compared to `var i=0`. PR-URL: #5819 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trevnorris@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Ref: http://github.com/nodejs/benchmarking/issues/38
Using let in for loops showed a regression in 4.4.0. @ofrobots suggested that we avoid using let in for loops until TurboFan becomes the default optimiser. The regression that was detected was when looking at how long it took to create a new buffer from an array of data. When using `for (let i=0; i<length; i++) ` we saw the operation take almost 40% longer compared to `var i=0`. PR-URL: #5819 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trevnorris@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Ref: http://github.com/nodejs/benchmarking/issues/38
|
@nodejs/lts we usually wait for things to spend time on v5 before backporting. This change is unlikely to cause breakage, and will result in immediate performance improvements. Are people opposed to having this land in this weeks release? |
Sorry, something went wrong.
|
No objections |
Sorry, something went wrong.
Using let in for loops showed a regression in 4.4.0. @ofrobots suggested that we avoid using let in for loops until TurboFan becomes the default optimiser. The regression that was detected was when looking at how long it took to create a new buffer from an array of data. When using `for (let i=0; i<length; i++) ` we saw the operation take almost 40% longer compared to `var i=0`. PR-URL: #5819 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trevnorris@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Ref: http://github.com/nodejs/benchmarking/issues/38
Using let in for loops showed a regression in 4.4.0. @ofrobots suggested that we avoid using let in for loops until TurboFan becomes the default optimiser. The regression that was detected was when looking at how long it took to create a new buffer from an array of data. When using `for (let i=0; i<length; i++) ` we saw the operation take almost 40% longer compared to `var i=0`. PR-URL: #5819 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trevnorris@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Ref: http://github.com/nodejs/benchmarking/issues/38
| Back | FazBrowse Home | New Git URL |
Pull Request check-list
Please make sure to review and check all of these items:
this change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Affected core subsystem(s)
buffer
Description of change
Using let in for loops showed a regression in 4.4.0. @ofrobots suggested
that we avoid using let in for loops until TurboFan becomes the default
optimiser.
As discussed in nodejs/benchmarking#38