-
-
Notifications
You must be signed in to change notification settings - Fork 649
Fix caching in Khuri-Makdisi Jacobian implementation #40221
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
Merged
Merged
Conversation
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
Documentation preview for this PR (built with commit d85d786; changes) is ready! 🎉 |
Wow. That was the worst bug I've ever made! Thanks a lot for fixing this. |
kwankyu
approved these changes
Jun 8, 2025
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jun 8, 2025
This PR fixes a bug with caching of some expensive parts of the Khuri- Makdisi Jacobian implementation. This speeds up constructing the Jacobian group by approximately 95% on the example below. The speedup was significant enough that I was able to remove `long test` from all but one test in the Khuri-Makdisi implementation. Testing the entire Khuri-Makdisi implementation takes slightly longer now that we are including more tests, but all the tests I've included finish in under 5 seconds (at least on my machine, if the CI complains we can put back some of the `long test` markers). ``` K = GF(5) Kx.<x> = FunctionField(K) t = polygen(Kx) F.<y> = Kx.extension(t^3 + (2*x^2 + 3*x + 3)*t^2 + (3*x^2 + x)*t + x^5 + 3*x^4 + 4*x^3 + 4*x^2 + x + 4) J = F.jacobian(model='km_small') %time J.group() # Before: About 1 minute. After: about 3 seconds. ``` The performance increase is similar for `km_medium` and `km_large`. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies None URL: sagemath#40221 Reported by: Vincent Macri Reviewer(s): Kwankyu Lee
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jun 9, 2025
This PR fixes a bug with caching of some expensive parts of the Khuri- Makdisi Jacobian implementation. This speeds up constructing the Jacobian group by approximately 95% on the example below. The speedup was significant enough that I was able to remove `long test` from all but one test in the Khuri-Makdisi implementation. Testing the entire Khuri-Makdisi implementation takes slightly longer now that we are including more tests, but all the tests I've included finish in under 5 seconds (at least on my machine, if the CI complains we can put back some of the `long test` markers). ``` K = GF(5) Kx.<x> = FunctionField(K) t = polygen(Kx) F.<y> = Kx.extension(t^3 + (2*x^2 + 3*x + 3)*t^2 + (3*x^2 + x)*t + x^5 + 3*x^4 + 4*x^3 + 4*x^2 + x + 4) J = F.jacobian(model='km_small') %time J.group() # Before: About 1 minute. After: about 3 seconds. ``` The performance increase is similar for `km_medium` and `km_large`. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies None URL: sagemath#40221 Reported by: Vincent Macri Reviewer(s): Kwankyu Lee
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jun 9, 2025
sagemathgh-40221: Fix caching in Khuri-Makdisi Jacobian implementation This PR fixes a bug with caching of some expensive parts of the Khuri- Makdisi Jacobian implementation. This speeds up constructing the Jacobian group by approximately 95% on the example below. The speedup was significant enough that I was able to remove `long test` from all but one test in the Khuri-Makdisi implementation. Testing the entire Khuri-Makdisi implementation takes slightly longer now that we are including more tests, but all the tests I've included finish in under 5 seconds (at least on my machine, if the CI complains we can put back some of the `long test` markers). ``` K = GF(5) Kx.<x> = FunctionField(K) t = polygen(Kx) F.<y> = Kx.extension(t^3 + (2*x^2 + 3*x + 3)*t^2 + (3*x^2 + x)*t + x^5 + 3*x^4 + 4*x^3 + 4*x^2 + x + 4) J = F.jacobian(model='km_small') %time J.group() # Before: About 1 minute. After: about 3 seconds. ``` The performance increase is similar for `km_medium` and `km_large`. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies None URL: sagemath#40221 Reported by: Vincent Macri Reviewer(s): Kwankyu Lee
Thanks for the quick review! |
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jun 9, 2025
sagemathgh-40221: Fix caching in Khuri-Makdisi Jacobian implementation This PR fixes a bug with caching of some expensive parts of the Khuri- Makdisi Jacobian implementation. This speeds up constructing the Jacobian group by approximately 95% on the example below. The speedup was significant enough that I was able to remove `long test` from all but one test in the Khuri-Makdisi implementation. Testing the entire Khuri-Makdisi implementation takes slightly longer now that we are including more tests, but all the tests I've included finish in under 5 seconds (at least on my machine, if the CI complains we can put back some of the `long test` markers). ``` K = GF(5) Kx.<x> = FunctionField(K) t = polygen(Kx) F.<y> = Kx.extension(t^3 + (2*x^2 + 3*x + 3)*t^2 + (3*x^2 + x)*t + x^5 + 3*x^4 + 4*x^3 + 4*x^2 + x + 4) J = F.jacobian(model='km_small') %time J.group() # Before: About 1 minute. After: about 3 seconds. ``` The performance increase is similar for `km_medium` and `km_large`. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies None URL: sagemath#40221 Reported by: Vincent Macri Reviewer(s): Kwankyu Lee
5 tasks
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.
This PR fixes a bug with caching of some expensive parts of the Khuri-Makdisi Jacobian implementation. This speeds up constructing the Jacobian group by approximately 95% on the example below. The speedup was significant enough that I was able to remove
long test
from all but one test in the Khuri-Makdisi implementation. Testing the entire Khuri-Makdisi implementation takes slightly longer now that we are including more tests, but all the tests I've included finish in under 5 seconds (at least on my machine, if the CI complains we can put back some of thelong test
markers).The performance increase is similar for
km_medium
andkm_large
.📝 Checklist
⌛ Dependencies
None