Opened 11 years ago
Closed 7 years ago
#9886 closed defect (duplicate)
slow coercion from integer mod ring to integer ring, part 2
Reported by: | dmharvey | Owned by: | tbd |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | performance | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | Ralf Stephan | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Sage 4.5.3, 2.6GHz Opteron, Linux
This is ok:
sage: R = Integers(3^20) sage: u = R(2) sage: timeit("z = u.lift()") 625 loops, best of 3: 351 ns per loop
This is not:
sage: timeit("z = ZZ(u)") 625 loops, best of 3: 37.9 µs per loop
Wow. See also #9885 for a not-quite-as-insane version of this.
Change History (5)
comment:1 Changed 11 years ago by
comment:2 Changed 10 years ago by
I figured out why. Hashing for R is slow, and ZZ._convert_map_hash needs to compute hash(R) to get the appropriate morphism. See #10130 for a patch fixing this.
comment:3 Changed 7 years ago by
- Milestone set to sage-duplicate/invalid/wontfix
- Status changed from new to needs_review
sage-6.2.beta4:
sage: sage: timeit("z = u.lift()") 625 loops, best of 3: 142 ns per loop sage: sage: timeit("z = ZZ(u)") 625 loops, best of 3: 280 ns per loop
comment:4 Changed 7 years ago by
- Reviewers set to Ralf Stephan
- Status changed from needs_review to positive_review
Similar relative result here. (However, my times are 3x slower with 3GHz AMD Phenom, fascinating).
comment:5 Changed 7 years ago by
- Resolution set to duplicate
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
The patch at #9887 should fix this, but it doesn't. I'm not sure why.