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: use plain iterator for payload unmasking #81

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Jun 19, 2024

This tweaks unmask_easy logic in order to directly use an enumerating iterator. It allows the compiler to generate more optimal machine code by performing internal iteration directly on the input slice.

This tweaks `unmask_easy` logic in order to directly use an enumerating
iterator. It allows the compiler to generate more optimal machine
code by performing internal iteration directly on the input slice.
@lucab
Copy link
Contributor Author

lucab commented Jun 19, 2024

On my Linux laptop with AMD Ryzen 7, this shows a small but reliable micro-benchmark improvement:

Finished release [optimized] target(s) in 16.03s
Running benches/unmask.rs (target/release/deps/unmask-c8256fdf566f5dbf)

unmask2/unmask 64 << 20 time:   [2.3568 ms 2.3596 ms 2.3641 ms]
                        thrpt:  [26.437 GiB/s 26.488 GiB/s 26.519 GiB/s]
                 change:
                        time:   [-8.4860% -7.2746% -6.0839%] (p = 0.00 < 0.05)
                        thrpt:  [+6.4780% +7.8453% +9.2729%]
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) high mild
  5 (5.00%) high severe

Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@littledivy littledivy merged commit 5384510 into denoland:main Jun 20, 2024
3 checks passed
@lucab lucab deleted the ups/mask-iterator branch June 20, 2024 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants