-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce unnecessary usage of Array.prototype.concat()
#15059
Conversation
There are obviously cases where using `concat` makes perfect sense, since that method doesn't change any of the existing Arrays; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat However, in a few cases throughout the code-base that's not an issue and using `concat` only leads to unnecessary intermediate allocations. With modern JavaScript we can thus replace those with a combination of `push` and spread-syntax, which wasn't originally possible when the code was written.
a3e9351
to
c21f4fa
Compare
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/04246c5db8b43b8/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/f9c1e70d89eb894/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/f9c1e70d89eb894/output.txt Total script time: 26.60 mins
Image differences available at: http://54.241.84.105:8877/f9c1e70d89eb894/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/04246c5db8b43b8/output.txt Total script time: 28.64 mins
Image differences available at: http://54.193.163.58:8877/04246c5db8b43b8/reftest-analyzer.html#web=eq.log |
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/3776a8ac6e123af/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/23e727916dc5357/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/3776a8ac6e123af/output.txt Total script time: 4.60 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/23e727916dc5357/output.txt Total script time: 7.28 mins
|
Thank you! |
There are obviously cases where using
concat
makes perfect sense, since that method doesn't change any of the existing Arrays; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concatHowever, in a few cases throughout the code-base that's not an issue and using
concat
only leads to unnecessary intermediate allocations. With modern JavaScript we can thus replace those with a combination ofpush
and spread-syntax, which wasn't originally possible when the code was written.