Uh oh!
There was an error while loading. Please reload this page.
lib: use arrow functions instead of bind - #3622
Conversation
kenany
commented
Nov 1, 2015
I don't think you should touch anything in |
Fishrock123
commented
Nov 1, 2015
Yes, please be sure not to touch anything in |
Fishrock123
commented
Nov 1, 2015
@JungMinu instead of making a new PR you can just amend you changes (via |
Fishrock123
commented
Nov 1, 2015
@JungMinu actually; even more specific: please only do files in |
mscdex
commented
Nov 1, 2015
Looks like the file permissions for the files in Also, have you done any benchmarking to show before and after these changes? Looking at the diff, I'm not sure that these changes actually affect any hot code paths. |
Trott
commented
Nov 1, 2015
Except for the last sentence, the PR text appears to be copied from https://www.nczonline.net/blog/2013/09/10/understanding-ecmascript-6-arrow-functions/. If you want to use someone else's text verbatim, please remember to cite it. |
Trott
commented
Nov 1, 2015
jbergstroem
commented
Nov 1, 2015
I'd be keen to see that benchmark as well before landing this. |
Trott
commented
Nov 1, 2015
The win here, at least the way I see it, is in readability by getting rid of all the As noted by @mscdex, none of this looks like it's in a hot path and so I very much doubt any of this will result in a measurable performance boost. Benchmark proving otherwise welcome, but it seems like the benefit here is a the readability/maintainability gain. |
mscdex
commented
Nov 1, 2015
IMHO as far as readability goes, it's about the same, maybe worse (but that would be more of a general ES6 problem). |
jbergstroem
commented
Nov 1, 2015
I guess where I was heading was that if this goes in with "faster" as the commit message it should be properly warranted. Style "fixes" is another category. |
Fishrock123
commented
Nov 1, 2015
|
trevnorris
commented
Nov 2, 2015
Minus the file permission changes, LGTM. As @mscdex mentioned, it's not an improvement in readability, but that's not what we're going after. In these specific locations there's nothing hot so won't notice a performance gain, but might as well make the change where it makes sense. |
Fishrock123
commented
Nov 2, 2015
@JungMinu I'm not sure you caught every case of Also how did you edit the files? I'm not sure what would have caused those mode changes. |
Fishrock123
commented
Nov 2, 2015
Oh, maybe those mode changes were from previously changing those files.. |
Fishrock123
commented
Nov 2, 2015
ok, that search from my windows machine wasn't correct, but using Atom Editor I find 28 results across 7 files for Looks like there's nothing in |
bnoordhuis
commented
Nov 3, 2015
Abandoning PRs and refiling them again is kind of annoying because it loses the discussion and the review history (of which there was quite a bit, it looks like.) Can I suggest you do a rebase, fix up the issues and force-push to your existing branch? |
bnoordhuis
commented
Nov 3, 2015
If your implicit question is 'how?', check the documentation for |
bnoordhuis
commented
Nov 3, 2015
Presumably your editor did something to those files? When in doubt, use vim. |
Fishrock123
commented
Nov 3, 2015
Hmm, A consideration we should make: If there is a If it were possible Ideally we'd have We could write it as @trevnorris Does that sound about right? I think we need to be careful for now. Rest params come in v8 4.7, so we could just have this target master once that lands, even though it'l be 6 months until it ships then. |
cjihrig
commented
Nov 3, 2015
There is no rush on this change, right? |
Fishrock123
commented
Nov 3, 2015
@cjihrig Correct. (That being said, it would be nice to have subset in v5 if possible.) |
trevnorris
commented
Nov 3, 2015
@Fishrock123 Currently rest parameters are even less optimized than |
* http: - A new status code was added: 451 - "Unavailable For Legal Reasons" (Max Barinov) nodejs#4377 - Idle sockets that have been kept alive now handle errors (José F. Romaniello) nodejs#4482 * This release also includes several minor performance improvements: - assert: deepEqual is now speedier when comparing TypedArrays (Claudio Rodriguez) nodejs#4330 - lib: Use arrow functions instead of bind where possible (Minwoo Jung) nodejs#3622 - node: Improved accessor perf of process.env (Trevor Norris) nodejs#3780 - node: Improved performance of process.hrtime() (Trevor Norris) nodejs#3780, (Evan Lucas) nodejs#4484 - node: Improved GetActiveHandles performance (Trevor Norris) nodejs#3780 - util: Use faster iteration in util.format() (Jackson Tian) nodejs#3964 PR-URL: nodejs#4547
* http: - A new status code was added: 451 - "Unavailable For Legal Reasons" (Max Barinov) nodejs#4377 - Idle sockets that have been kept alive now handle errors (José F. Romaniello) nodejs#4482 * This release also includes several minor performance improvements: - assert: deepEqual is now speedier when comparing TypedArrays (Claudio Rodriguez) nodejs#4330 - lib: Use arrow functions instead of bind where possible (Minwoo Jung) nodejs#3622 - node: Improved accessor perf of process.env (Trevor Norris) nodejs#3780 - node: Improved performance of process.hrtime() (Trevor Norris) nodejs#3780, (Evan Lucas) nodejs#4484 - node: Improved GetActiveHandles performance (Trevor Norris) nodejs#3780 - util: Use faster iteration in util.format() (Jackson Tian) nodejs#3964 Refs: nodejs#4547 PR-URL: nodejs#4623 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
use `arrow functions` instead of `bind(this)` in order to improve performance through optimizations. PR-URL: #3622 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
MylesBorins
commented
Jan 13, 2016
Just putting a note here that this commit has still not landed in v5.4.x |
Fishrock123
commented
Jan 13, 2016
Some backstory on that:
|
use `arrow functions` instead of `bind(this)` in order to improve performance through optimizations. PR-URL: #3622 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Notable changes: * events: make sure console functions exist (Dave) #4479 * fs: add autoClose option to fs.createWriteStream (Saquib) #3679 * http: improves expect header handling (Daniel Sellers) #4501 * node: allow preload modules with -i (Evan Lucas) #4696 * v8,src: expose statistics about heap spaces (`v8.getHeapSpaceStatistics()`) (Ben Ripkens) #4463 * Minor performance improvements: - lib: Use arrow functions instead of bind where possible (Minwoo Jung) #3622 - module: cache stat() results more aggressively (Ben Noordhuis) #4575 - querystring: improve parse() performance (Brian White) #4675 PR-URL: #4742
Notable changes: * events: make sure console functions exist (Dave) #4479 * fs: add autoClose option to fs.createWriteStream (Saquib) #3679 * http: improves expect header handling (Daniel Sellers) #4501 * node: allow preload modules with -i (Evan Lucas) #4696 * v8,src: expose statistics about heap spaces (`v8.getHeapSpaceStatistics()`) (Ben Ripkens) #4463 * Minor performance improvements: - lib: Use arrow functions instead of bind where possible (Minwoo Jung) #3622 - module: cache stat() results more aggressively (Ben Noordhuis) #4575 - querystring: improve parse() performance (Brian White) #4675 PR-URL: #4742
balupton
commented
Jan 21, 2016
Regarding benchmarks, I'm not sure if the requests were for bind to arrow functions performance in general, or their performance when applied to node's codebase via this PR. For the former, for those interested, there is https://github.com/bevry/esnext-benchmarks which compares performance with several esnext features with the es2015 and other counterparts. Perhaps it will be useful for some readers. If it was the latter, can't help there. |
use `arrow functions` instead of `bind(this)` in order to improve performance through optimizations. PR-URL: #3622 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
use `arrow functions` instead of `bind(this)` in order to improve performance through optimizations. PR-URL: #3622 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
use `arrow functions` instead of `bind(this)` in order to improve performance through optimizations. PR-URL: #3622 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
use `arrow functions` instead of `bind(this)` in order to improve performance through optimizations. PR-URL: nodejs#3622 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
* http: - A new status code was added: 451 - "Unavailable For Legal Reasons" (Max Barinov) nodejs#4377 - Idle sockets that have been kept alive now handle errors (José F. Romaniello) nodejs#4482 * This release also includes several minor performance improvements: - assert: deepEqual is now speedier when comparing TypedArrays (Claudio Rodriguez) nodejs#4330 - lib: Use arrow functions instead of bind where possible (Minwoo Jung) nodejs#3622 - node: Improved accessor perf of process.env (Trevor Norris) nodejs#3780 - node: Improved performance of process.hrtime() (Trevor Norris) nodejs#3780, (Evan Lucas) nodejs#4484 - node: Improved GetActiveHandles performance (Trevor Norris) nodejs#3780 - util: Use faster iteration in util.format() (Jackson Tian) nodejs#3964 Refs: nodejs#4547 PR-URL: nodejs#4623 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Notable changes: * events: make sure console functions exist (Dave) nodejs#4479 * fs: add autoClose option to fs.createWriteStream (Saquib) nodejs#3679 * http: improves expect header handling (Daniel Sellers) nodejs#4501 * node: allow preload modules with -i (Evan Lucas) nodejs#4696 * v8,src: expose statistics about heap spaces (`v8.getHeapSpaceStatistics()`) (Ben Ripkens) nodejs#4463 * Minor performance improvements: - lib: Use arrow functions instead of bind where possible (Minwoo Jung) nodejs#3622 - module: cache stat() results more aggressively (Ben Noordhuis) nodejs#4575 - querystring: improve parse() performance (Brian White) nodejs#4675 PR-URL: nodejs#4742
use
arrow functionsinstead ofbind(this)in order to improveperformance through optimizations.