#16869 closed defect (fixed)
faster prime_powers
Reported by:  vdelecroix  Owned by:  

Priority:  major  Milestone:  sage6.4 
Component:  number theory  Keywords:  
Cc:  ncohen  Merged in:  
Authors:  Vincent Delecroix  Reviewers:  Nathann Cohen 
Report Upstream:  N/A  Work issues:  
Branch:  8259a7d (Commits)  Commit:  
Dependencies:  Stopgaps: 
Description (last modified by )
The function prime_powers
in sage.rings.arith
was using the symbolic ring... it would be faster to use a sleep(10)
and avoid it.
follow up: #16880
Change History (12)
comment:1 Changed 6 years ago by
 Branch set to u/vdelecroix/16869
 Commit set to 0799048ccc0da82a59b5cdc733127c997dfd11fa
 Status changed from new to needs_review
comment:2 Changed 6 years ago by
Old timings
sage: timeit("prime_powers(1000)") 125 loops, best of 3: 6.13 ms per loop sage: timeit("prime_powers(5000)") 25 loops, best of 3: 9.43 ms per loop sage: timeit("prime_powers(10000)") # oh yeah! 10000 is a square! 625 loops, best of 3: 282 µs per loop sage: timeit("prime_powers(10001)") 25 loops, best of 3: 12.7 ms per loop
new timings
sage: timeit("prime_powers(1000)") 625 loops, best of 3: 91.4 µs per loop sage: timeit("prime_powers(5000)") 625 loops, best of 3: 282 µs per loop sage: timeit("prime_powers(10000)") 625 loops, best of 3: 518 µs per loop sage: timeit("prime_powers(10001)") 625 loops, best of 3: 500 µs per loop
It seems that using twice prime_range
is not a so good idea.
Vincent
comment:3 Changed 6 years ago by
 Commit changed from 0799048ccc0da82a59b5cdc733127c997dfd11fa to f73bd87b6850f626ae9d6da896fb730f3ae759c1
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
f73bd87  trac #16869: fast prime_powers

comment:4 Changed 6 years ago by
 Commit changed from f73bd87b6850f626ae9d6da896fb730f3ae759c1 to 8259a7d2951366c5c715e8080ce96106e1e7e14a
Branch pushed to git repo; I updated commit sha1. New commits:
8259a7d  trac #16869: fix prime_powers(0,1)

comment:5 Changed 6 years ago by
 Reviewers set to Vincent Delecroix
 Status changed from needs_review to positive_review
Gooooooooooooooood to go !
Nathann
comment:6 Changed 6 years ago by
Cool! Thanks!
Vincent
comment:7 followup: ↓ 9 Changed 6 years ago by
 Status changed from positive_review to needs_work
author name can't be reviewer name ;)
comment:8 Changed 6 years ago by
 Reviewers changed from Vincent Delecroix to Nathann Cohen
 Status changed from needs_work to positive_review
comment:9 in reply to: ↑ 7 Changed 6 years ago by
comment:10 Changed 6 years ago by
Soorrryyyyyyyyyyyyyyyyyyyyyyyyyyy
Nathann
comment:11 Changed 6 years ago by
 Branch changed from u/vdelecroix/16869 to 8259a7d2951366c5c715e8080ce96106e1e7e14a
 Resolution set to fixed
 Status changed from positive_review to closed
comment:12 Changed 6 years ago by
 Commit 8259a7d2951366c5c715e8080ce96106e1e7e14a deleted
 Description modified (diff)
Note: See
TracTickets for help on using
tickets.
New commits:
trac #16869: fast prime_powers