id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
467 [with patch] asymptotically slow pari integer conversions dmharvey craigcitro "The conversion function from PARI integers to python longs is asymptotically slow (apparantly quadratic time). This shows up when doing something like {{{int(some_pari_object)}}}. Similarly from SAGE integers to PARI integers.
There are also inconsistencies like (on my machine at home):
{{{
sage: x = 10^100000
sage: time y = pari(x)
CPU times: user 1.18 s, sys: 0.01 s, total: 1.19 s
Wall time: 1.26
sage: time z = Integer(y)
CPU times: user 0.00 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.02
sage: time u = int(y)
CPU times: user 1.94 s, sys: 1.33 s, total: 3.27 s
Wall time: 3.58
sage: time u = int(Integer(y))
CPU times: user 0.00 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.03
}}}
now see the quadratic time:
{{{
sage: x = 10^1000000
sage: time y = pari(x)
CPU times: user 105.12 s, sys: 1.26 s, total: 106.38 s
Wall time: 121.86
sage: time z = Integer(y)
CPU times: user 0.03 s, sys: 0.02 s, total: 0.05 s
Wall time: 0.09
sage: time u = int(y)
CPU times: user 188.17 s, sys: 145.12 s, total: 333.28 s
Wall time: 364.80
sage: time u = int(Integer(y))
CPU times: user 0.04 s, sys: 0.02 s, total: 0.06 s
Wall time: 0.07
}}}
" enhancement closed minor sage-2.8.7 basic arithmetic fixed