-
Notifications
You must be signed in to change notification settings - Fork 145
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
Small perf adjustments for ShortWeierstrassProjectivePoint
operations
#842
Small perf adjustments for ShortWeierstrassProjectivePoint
operations
#842
Conversation
I don't think the first optimization is right. The early return adds an additional branch, so it may make the average case slower, and we usually don't care about optimizing the neutral element case. You need to bench this and compare it, but I highly doubt the additional branch is worth. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #842 +/- ##
==========================================
- Coverage 72.32% 72.32% -0.01%
==========================================
Files 147 147
Lines 33820 33823 +3
==========================================
+ Hits 24459 24461 +2
- Misses 9361 9362 +1 ☔ View full report in Codecov by Sentry. |
Here is the benchmark for the double case (for the general situation):
point Projective Double | Lambdaworks
time: [364.85 ns 364.97 ns 365.09 ns]
Found 7 outliers among 100 measurements (7.00%)
5 (5.00%) high mild
2 (2.00%) high severe
point Projective Double | Lambdaworks
time: [364.55 ns 365.17 ns 366.33 ns]
change: [-0.1313% +0.0010% +0.1993%] (p = 1.00 > 0.05)
No change in performance detected.
Found 10 outliers among 100 measurements (10.00%)
4 (4.00%) high mild
6 (6.00%) high severe |
@entropidelic Let me know if there is something to do here |
Small perf adjustments for
ShortWeierstrassProjectivePoint
operationsDescription
In the
double
operation, the pull request implements an early return strategy to check ifself
is the neutral element before performing any further calculations. Ifself
is indeed the neutral element, the function immediately returns a clone ofself
. This optimization enhances performance by avoiding unnecessary computations, resulting in faster execution.The pull request optimizes the
operate_with_affine
function by reordering the sequence of operations. Previously, the function performed certain calculations before checking ifself
orother
were neutral elements. This resulted in unnecessary computation overhead. The pull request rectifies this by placing the neutral element check at the beginning of the function. If eitherself
orother
is the neutral element, the function terminates early, saving computational costs and improving overall efficiency.Type of change
Please delete options that are not relevant.
Checklist