#864: Asymptotically slow PARI --> Python long conversions
-------------------------------+------------------------------
Reporter: craigcitro | Owner: craigcitro
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-5.13
Component: performance | Resolution:
Keywords: pari | Merged in:
Authors: Peter Bruin | Reviewers: Jeroen Demeyer
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------+------------------------------
Changes (by pbruin):
* status: needs_work => needs_review
Old description:
> This is really a leftover from ticket #467, split because I wanted the
> first half of the fix to make it into 2.8.7. Here's a summary of the
> badness:
>
> {{{
> 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
>
> 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
> }}}
>
> And here's the state of affairs after the first patch:
>
> {{{
> sage: x = 10^100000
>
> sage: time y = pari(x)
> CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
> Wall time: 0.00
>
> sage: time z = Integer(y)
> CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
> Wall time: 0.00
>
> sage: time u = int(y)
> CPU times: user 1.64 s, sys: 1.09 s, total: 2.73 s
> Wall time: 2.79
>
> sage: time u = int(Integer(y))
> CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
> Wall time: 0.00
>
> sage: x = 10^1000000
>
> sage: time y = pari(x)
> CPU times: user 0.00 s, sys: 0.00 s, total: 0.01 s
> Wall time: 0.01
>
> sage: time z = Integer(y)
> CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
> Wall time: 0.00
>
> sage: time u = int(y)
> CPU times: user 220.90 s, sys: 137.34 s, total: 358.24 s
> Wall time: 408.11
>
> sage: time u = int(Integer(y))
> CPU times: user 0.00 s, sys: 0.00 s, total: 0.01 s
> Wall time: 0.01
>
> }}}
>
> Clearly that third function call needs to be fixed, and it will be within
> a few days.
New description:
This is really a leftover from ticket #467, split because I wanted the
first half of the fix to make it into 2.8.7. Here's a summary of the
badness:
{{{
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
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
}}}
And here's the state of affairs after the first patch:
{{{
sage: x = 10^100000
sage: time y = pari(x)
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00
sage: time z = Integer(y)
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00
sage: time u = int(y)
CPU times: user 1.64 s, sys: 1.09 s, total: 2.73 s
Wall time: 2.79
sage: time u = int(Integer(y))
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00
sage: x = 10^1000000
sage: time y = pari(x)
CPU times: user 0.00 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.01
sage: time z = Integer(y)
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00
sage: time u = int(y)
CPU times: user 220.90 s, sys: 137.34 s, total: 358.24 s
Wall time: 408.11
sage: time u = int(Integer(y))
CPU times: user 0.00 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.01
}}}
Clearly that third function call needs to be fixed; this is done by the
attached patch.
Apply: [attachment:trac_864-pari_int_long_conversion.patch]
--
Comment:
apply trac_864-pari_int_long_conversion.patch
--
Ticket URL: <http://trac.sagemath.org/ticket/864#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.