Opened 5 years ago
Closed 5 years ago
#12527 closed enhancement (fixed)
Use cached_method for FractionField.is_exact
Reported by: | nthiery | Owned by: | tbd |
---|---|---|---|
Priority: | major | Milestone: | sage-5.0 |
Component: | performance | Keywords: | |
Cc: | king | Merged in: | sage-5.0.beta9 |
Authors: | Nicolas M. Thiéry | Reviewers: | David Loeffler |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Before the patch:
sage: sage: P = ZZ['x'] sage: R = P.fraction_field() sage: %timeit R.is_exact() 625 loops, best of 3: 3.7 µs per loop
After the patch:
sage: R=FractionField(ZZ['x']) sage: %timeit R.is_exact() 625 loops, best of 3: 485 ns per loop
Thank you Simon King for #11115!
This is non negligible because is_exact
is called basically each
time an element is constructed or arithmetic is performed. Here we
have a 10% improvement on constructing an element:
Before the patch:
sage: x = P.gen() sage: y = x+1 sage: %timeit R(x,y,coerce=False) 625 loops, best of 3: 17.7 µs per loop
After the patch:
sage: x = P.gen() sage: y = x+1 sage: %timeit R(x,y,coerce=False) 625 loops, best of 3: 16 µs per loop
Attachments (1)
Change History (4)
Changed 5 years ago by
comment:1 Changed 5 years ago by
- Status changed from new to needs_review
comment:2 Changed 5 years ago by
- Reviewers changed from Simon King to David Loeffler
- Status changed from needs_review to positive_review
Isn't patchbot great? It makes reviewing patches like this a 10-second job. Sorry Simon!
comment:3 Changed 5 years ago by
- Merged in set to sage-5.0.beta9
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Simon: you deserve this trivial review, for all your hard work on other related tickets :-)