Skip to content

Conversation

@tarcieri
Copy link
Member

Optimizes ConstantTimeGreater/ConstantTimeLess impls by using borrowing subtraction and checking whether a borrow occurred.

Benchmarks

ops/ct_lt               time:   [900.95 ps 909.83 ps 922.37 ps]
                        change: [-76.095% -75.752% -75.373%] (p = 0.00 < 0.05)
                        Performance has improved.
ops/ct_gt               time:   [902.46 ps 938.83 ps 1.0134 ns]
                        change: [-55.763% -53.637% -50.192%] (p = 0.00 < 0.05)
                        Performance has improved.

Optimizes `ConstantTimeGreater`/`ConstantTimeLess` impls by using
borrowing subtraction and checking whether a borrow occurred.

ops/ct_lt               time:   [900.95 ps 909.83 ps 922.37 ps]
                        change: [-76.095% -75.752% -75.373%] (p = 0.00 < 0.05)
                        Performance has improved.

ops/ct_gt               time:   [902.46 ps 938.83 ps 1.0134 ns]
                        change: [-55.763% -53.637% -50.192%] (p = 0.00 < 0.05)
                        Performance has improved.
@tarcieri tarcieri merged commit 4966407 into master Dec 10, 2023
@tarcieri tarcieri deleted the limb/optimize-ct-comparisons branch December 10, 2023 19:46
@fjarri
Copy link
Contributor

fjarri commented Dec 12, 2023

Is it a better algorithm than the one used in CtChoice? We should pick one and use it in both places.

@tarcieri
Copy link
Member Author

Definitely worth comparing options, as this is a major bottleneck for #415

@fjarri
Copy link
Contributor

fjarri commented Dec 12, 2023

Filed #418

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.

3 participants