Skip to content
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

Merged
merged 1 commit into from
Jun 19, 2022

Conversation

Snuffleupagus
Copy link
Collaborator

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.

@Snuffleupagus Snuffleupagus marked this pull request as draft June 19, 2022 11:23
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.
@mozilla mozilla deleted a comment from pdfjsbot Jun 19, 2022
@mozilla mozilla deleted a comment from pdfjsbot Jun 19, 2022
@mozilla mozilla deleted a comment from pdfjsbot Jun 19, 2022
@mozilla mozilla deleted a comment from pdfjsbot Jun 19, 2022
@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/04246c5db8b43b8/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/f9c1e70d89eb894/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/f9c1e70d89eb894/output.txt

Total script time: 26.60 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 26
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/f9c1e70d89eb894/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/04246c5db8b43b8/output.txt

Total script time: 28.64 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/04246c5db8b43b8/reftest-analyzer.html#web=eq.log

@Snuffleupagus Snuffleupagus marked this pull request as ready for review June 19, 2022 12:14
@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/3776a8ac6e123af/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/23e727916dc5357/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/3776a8ac6e123af/output.txt

Total script time: 4.60 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/23e727916dc5357/output.txt

Total script time: 7.28 mins

  • Integration Tests: FAILED

@timvandermeij timvandermeij merged commit 45de73b into mozilla:master Jun 19, 2022
@timvandermeij
Copy link
Contributor

Thank you!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants