-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #34281: defer primality and irreducibility testing in GF constru…
…ctor until after caching Example: {{{#!sage sage: p = 2^521-1 sage: F = GF(p) sage: GF(p) is F # field is cached True sage: %timeit GF(p) 521 ms ± 6.46 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) }}} Note that the constructor tests primality ''each time'' even though the field is already cached! This was pointed out here: https://github.com/jack4818/Castryck-Decru-SageMath#speeding-sagemath- up-using-a-cache In this patch, we move the primality and irreducibility testing from `FiniteFieldFactory.create_key_and_extra_args()` to `FiniteFieldFactory.create_object()`, so that it isn't performed again for fields already present in the cache. The result is a massive speedup for repeated invocations of `GF(p)`: {{{ 78.6 µs ± 870 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each) }}} URL: https://trac.sagemath.org/34281 Reported by: lorenz Ticket author(s): Lorenz Panny Reviewer(s): Julien Grijalva
- Loading branch information
Showing
3 changed files
with
42 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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