#18358: a cython function that produces long given python input
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.7
      Component:  coercion           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/18358                 |  8e9148450538c683d50c89d90acf7457feb0cc03
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):

 * status:  needs_work => needs_review
 * commit:   => 8e9148450538c683d50c89d90acf7457feb0cc03
 * branch:   => u/vdelecroix/18358


Comment:

 Here is an experimental branch with a macro `pyobject_to_long` in
 `sage.misc.long`. I do not like the gestion of error but I do not know how
 to do better without affecting performance. Please tell me.

 It is used in `Integer.__pow__` and `Rational.__pow__` as a proof of
 concept. And we win 20 precious nano seconds when the exponent is a small
 Sage Integer (~10%):
 {{{
 sage: timeit("2**5", number=400000, repeat=20)
 400000 loops, best of 20: 248 ns per loop
 sage: timeit("(2/3)**2", number=100000, repeat=20)
 100000 loops, best of 20: 1.1 µs per loop
 }}}
 against
 {{{
 sage: timeit("2**5", number=400000, repeat=20)
 400000 loops, best of 20: 228 ns per loop
 sage: timeit("(2/3)**2", number=100000, repeat=20)
 200000 loops, best of 30: 990 ns per loop
 }}}

 Vincent
 ----
 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=524393b4aa89d93d8cc6831480e07c7350c06535
 524393b]||{{{Trac 18290: upgrade sets and cartesian products}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=6e1e22d1ae7c494773df4b161690d707762558c7
 6e1e22d]||{{{Trac 18290: better doc + remove duplications}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=671e6ecff8079a28f9b43fda96da29530ba454a8
 671e6ec]||{{{Trac 18290: fix doctest in combinat/tutorial}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=0378c4a5319972501b1d982c3670085f139c1dd4
 0378c4a]||{{{Trac 18290: fix doctest in categories/enumerated_sets.py}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=925b2e062bb86212916b73c831f9333f312db4b5
 925b2e0]||{{{Trac 18290: fix doctests}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=8e9148450538c683d50c89d90acf7457feb0cc03
 8e91484]||{{{Trac 18358: macro to cast Python object to C long}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/18358#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/d/optout.

Reply via email to