perf: Doubling and mixed doubling in Jacobians and ext. Jacobians#716
Merged
perf: Doubling and mixed doubling in Jacobians and ext. Jacobians#716
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes elliptic curve point operations by implementing more efficient algorithms for Jacobian doubling and extended Jacobian mixed doubling operations, resulting in performance improvements of 2m (multiplication) for Jacobian doubling and 3m for extended Jacobian mixed doubling. Additionally, the PR corrects comment URLs to reference the proper EFD (Explicit-Formula Database) formulas and adds computational cost annotations to document the complexity of each operation.
Key changes include:
- Replacement of existing Jacobian doubling implementation with a more efficient algorithm (saves 2m)
- Optimization of extended Jacobian mixed doubling operations (saves 3m)
- Correction of EFD formula URLs in comments to point to the correct references
- Addition of cost annotations (~Cost: XM + YS) for better documentation of operation complexity
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/generator/ecc/template/point.go.tmpl | Template file containing optimized algorithms and corrected URL references |
| ecc/*/g1.go | Generated G1 curve implementations with optimized doubling operations |
| ecc/*/g2.go | Generated G2 curve implementations with optimized doubling operations |
Comments suppressed due to low confidence (1)
internal/generator/ecc/template/point.go.tmpl:961
- The comment incorrectly references 'double' instead of 'doubleMixed'. This should be updated to maintain consistency with the corrected comment pattern used elsewhere in the PR.
t1.Double(&res)
gbotrel
approved these changes
Aug 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR corrects comments (URL to EFD forumulas) and saves
2min Jacobian doubling and3min extended Jacobian mixed doubling.Type of change
How has this been tested?
Current tests pass.
How has this been benchmarked?
e.g. BLS12-381 on MBA M1:
Checklist:
golangci-lintdoes not output errors locally