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 fdiv's into fmul's #1204

Merged
merged 5 commits into from
Nov 19, 2024
Merged

Reduce fdiv's into fmul's #1204

merged 5 commits into from
Nov 19, 2024

Conversation

heshpdx
Copy link
Contributor

@heshpdx heshpdx commented Oct 5, 2024

Provides small speedup on microarchitectures where the floating point divide is slower than the floating point multiply.

As measured on an Ampere Altra, I see about +0.5% depending on the input.

$ ./brotli.old -fvk -w 0 enwik8.xhtml
Compressed [enwik8.xhtml]: 95.367 MiB -> 24.549 MiB in 237.92 sec

$ ./brotli.new -fvk -w 0 enwik8.xhtml
Compressed [enwik8.xhtml]: 95.367 MiB -> 24.549 MiB in 236.72 sec

c/enc/block_splitter_inc.h Outdated Show resolved Hide resolved
@eustas
Copy link
Collaborator

eustas commented Nov 12, 2024

Awesome. Please add static constant for constants that derived from 1 / 2000.0; even better would be extracting 2000 itself as well to something like prologue_length, or simply threshold. Thanks.

eustas
eustas previously approved these changes Nov 12, 2024
@heshpdx
Copy link
Contributor Author

heshpdx commented Nov 12, 2024

Awesome. Please add static constant for constants that derived from 1 / 2000.0; even better would be extracting 2000 itself as well to something like prologue_length, or simply threshold. Thanks.

Done! All tests still pass.

c/enc/block_splitter_inc.h Outdated Show resolved Hide resolved
c/enc/block_splitter_inc.h Outdated Show resolved Hide resolved
c/enc/block_splitter_inc.h Outdated Show resolved Hide resolved
c/enc/literal_cost.c Outdated Show resolved Hide resolved
c/enc/literal_cost.c Outdated Show resolved Hide resolved
c/enc/literal_cost.c Outdated Show resolved Hide resolved
eustas
eustas previously approved these changes Nov 12, 2024
Copy link
Collaborator

@eustas eustas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Added a bit of polishing with suggested-edits.

eustas
eustas previously approved these changes Nov 14, 2024
c/enc/encode.c Outdated Show resolved Hide resolved
heshpdx and others added 5 commits November 19, 2024 09:52
Provides small speedup on microarchitectures where the floating
point divide is slower than the floating point multiply.
Added a digit of precision
Co-authored-by: Eugene Kliuchnikov <eustas@google.com>
Co-authored-by: Eugene Kliuchnikov <eustas@google.com>
@copybara-service copybara-service bot merged commit 2b6efcb into google:master Nov 19, 2024
35 of 39 checks passed
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.

2 participants