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
merged 1 commit into from Nov 9, 2022
Merged

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

merged 1 commit into from Nov 9, 2022

Conversation

alexzhang1030
Copy link
Contributor

@alexzhang1030 alexzhang1030 commented Sep 16, 2022

…ance

What kind of change does this PR introduce?

performance

Did you add tests for your changes?

No need

Does this PR introduce a breaking change?

No.

What needs to be documented once your changes are merged?

No.

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.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 16, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@webpack-bot
Copy link
Contributor

For maintainers only:

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

@alexzhang1030
Copy link
Contributor Author

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

@alexander-akait
Copy link
Member

Please ignore the fail (random fail)

@sokra sokra merged commit 6f2c5e8 into webpack:main Nov 9, 2022
@sokra
Copy link
Member

sokra commented Nov 9, 2022

Thanks

@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants