#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:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:               |     Stopgaps:
-------------------------------+----------------------------

Comment (by pbruin):

 Replying to [comment:5 jdemeyer]:
 > Replying to [comment:4 pbruin]:
 > > so `long(y)` essentially does `long(Integer(y))`.
 > Why not literally do `long(Integer(y))` then and save many lines of
 code?
 I thought that the penalty for creating an `Integer` was quite heavy in
 some cases; for example, with the current patch applied, I get
 {{{
 sage: y=pari(10^10000)
 sage: %timeit -c -r 1 u=long(y)
 100000 loops, best of 1: 12.2 us per loop
 sage: %timeit -c -r 1 u=long(Integer(y))
 10000 loops, best of 1: 19.6 us per loop
 }}}
 However, I just tried implementing `gen.__long__(self)` as `return
 long(Integer(self))`, and it is just as fast, thanks to Cython I guess.  I
 also agree that `long(pari("Mod(2,7)"))` is nice to get for free.  New
 patch coming soon.

--
Ticket URL: <http://trac.sagemath.org/ticket/864#comment:7>
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.

Reply via email to