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

perf: remove assignDeterministic verbose Math.ceil code to improve performance #16257

merged 1 commit into from Nov 9, 2022


Copy link

@alexzhang1030 alexzhang1030 commented Sep 16, 2022


What kind of change does this PR introduce?


Did you add tests for your changes?

No need

Does this PR introduce a breaking change?


What needs to be documented once your changes are merged?


Introduce about this PR

The old code about assignDeterministicIds fill rate is:

Math.ceil(items.length * 1.25)

but in this PR, it changed to

Math.ceil(items.length * 20)

Because items is an array, and its length will never be a decimal. So it's not necessary to add Math.ceil now.

I removed Math.ceil to improve the performance.

And this change will not cause any Breaking Change, I ran all tests.

Copy link

linux-foundation-easycla bot commented Sep 16, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

For maintainers only:

  • This needs to be documented (issue in webpack/ will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

Copy link
Contributor Author

@alexander-akait hey, may I ask you how to fix this test? In my local, it's passed.

Copy link

Please ignore the fail (random fail)

@sokra sokra merged commit 6f2c5e8 into webpack:main Nov 9, 2022
46 of 47 checks passed
Copy link

sokra commented Nov 9, 2022


@alexzhang1030 alexzhang1030 deleted the calc_deterministic_verbose branch November 9, 2022 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants