Uh oh!
There was an error while loading. Please reload this page.
repl: use String#repeat instead of Array#join - #3900
Conversation
Fishrock123
commented
Nov 18, 2015
LGTM, evidence of said perf would be nice of course. |
evanlucas
commented
Nov 18, 2015
In the common case here: This is testing: String#repeat 14.5 ns/op |
cjihrig
commented
Nov 18, 2015
LGTM. The speedup is nice. Not sure how important it is in the REPL. |
evanlucas
commented
Nov 18, 2015
The advantage is the speedup in showing the prompt IMO |
cjihrig
commented
Nov 18, 2015
I don't think anyone will perceive < 1us :-) It's still nice to know for more performance critical places. |
evanlucas
commented
Nov 18, 2015
yea, true |
ronkorving
commented
Nov 21, 2015
It seems that the only place where this pattern emerged is in repl.js, unless my grep is not revealing enough. |
There was a problem hiding this comment.
This could fit on a single line.
silverwind
commented
Dec 21, 2015
LGTM with style nit. By the way: https://jsperf.com/string-repeat-native-vs-array-join-vs-loop |
evanlucas
commented
Dec 21, 2015
Fixed the nit |
There was a problem hiding this comment.
ahh missed that one. Fixed
silverwind
commented
Dec 21, 2015
CI is happy, let's land it! |
evanlucas
commented
Dec 21, 2015
k, landing now |
String#repeat is quite a bit faster than new Array().join(). PR-URL: nodejs#3900 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
evanlucas
commented
Dec 21, 2015
Landed in 50125e2. Thanks! |
String#repeat is quite a bit faster than new Array().join(). PR-URL: nodejs#3900 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
String#repeat is quite a bit faster than new Array().join(). PR-URL: nodejs#3900 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
String#repeat is quite a bit faster than new Array().join(). PR-URL: #3900 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
String#repeat is quite a bit faster than new Array().join(). PR-URL: #3900 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
String#repeat is quite a bit faster than new Array().join(). PR-URL: nodejs#3900 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
String#repeat is quite a bit faster than new Array().join().