Improve performance of field_pretty for multiquadratic fields#7013
Open
rvisser7 wants to merge 4 commits into
Open
Improve performance of field_pretty for multiquadratic fields#7013rvisser7 wants to merge 4 commits into
rvisser7 wants to merge 4 commits into
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
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 makes some improvements to the
field_prettyfunction inweb_number_field.py, which computes latex names for certain number fields. In particular, it makes computing the latex names for biquadratic and more general multi-quadratic fields slightly more efficient.For quadratic fields, the computation of the$D$ in $Q(\sqrt{D})$ is now taken directly from the label (instead of calling WebNumberField), and the linear algebra for the multi-quadratic case is now done directly using bitwise XOR on integers (where we store a vector over F_2 just as a integer, where the bits are the entries of the vector), instead of calling Sage's general linear algebra methods.
The main motivation for this is to speed up the rendering time of the homepage for the degree 32 multi-quadratic field$Q(i, \sqrt{2}, \sqrt{3}, \sqrt{5}, \sqrt{7})$ :
https://www.lmfdb.org/NumberField/32.0.4026692887688564776141139207792885760000000000000000.1 (prod)
https://beta.lmfdb.org/NumberField/32.0.4026692887688564776141139207792885760000000000000000.1 (beta)
http://localhost:37777/NumberField/32.0.4026692887688564776141139207792885760000000000000000.1 (new)
which requires computing not just the latex name for this field, but the latex name for all 372 subfields!
At the moment, this takes ~12 seconds to load on production, and ~8 seconds to load on beta, assuming the latex names haven't been cached yet. From my testing, this PR now takes ~4 seconds to load, before caching. But hopefully this will load even faster on beta. Still not ideal, but at least an improvement from the current implementation. :)