Skip to content

Conversation

@tarcieri
Copy link
Member

The ConstantTimeSelect trait was a workaround for having a trait-based API that works for Boxed* and non-boxed types, since we can't impl subtle::ConditionallySelectable on Boxed* types since it has a Copy bound.

ctutils::CtSelect accomplishes the same goals by having only a Sized bound (since we need to be able to return selected values).

This commit completely replaces the ConstantTimeSelect trait with ctutils::CtSelect.

The `ConstantTimeSelect` trait was a workaround for having a trait-based
API that works for `Boxed*` and non-boxed types, since we can't impl
`subtle::ConditionallySelectable` on `Boxed*` types since it has a
`Copy` bound.

`ctutils::CtSelect` accomplishes the same goals by having only a `Sized`
bound (since we need to be able to return selected values).

This commit completely replaces the `ConstantTimeSelect` trait with
`ctutils::CtSelect`.
@codecov
Copy link

codecov bot commented Dec 27, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.29%. Comparing base (3b6064e) to head (eaef162).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/uint/boxed/ct.rs 75.00% 4 Missing ⚠️
src/uint/boxed/invert_mod.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1043      +/-   ##
==========================================
+ Coverage   79.21%   79.29%   +0.08%     
==========================================
  Files         164      164              
  Lines       17514    17497      -17     
==========================================
+ Hits        13873    13874       +1     
+ Misses       3641     3623      -18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tarcieri
Copy link
Member Author

As far as boxed ops go, since that's mainly what this PR impacts, I'm actually seeing a bunch of performance improvements for the most part, but all within a range where they may be spurious. So far there's only one 13% regression (in neg somehow? probably spurious)

@tarcieri tarcieri merged commit c5c8152 into master Dec 27, 2025
27 checks passed
@tarcieri tarcieri deleted the replace-constanttimeselect-with-ctutils-ctselect branch December 27, 2025 04:45
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