Changes between Initial Version and Version 1 of Ticket #17808


Ignore:
Timestamp:
Feb 19, 2015, 8:35:02 AM (8 years ago)
Author:
jdemeyer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17808 – Description

    initial v1  
    1414This has two advantages:
    1515
    16 1. it would also be a lot faster since MPIR parses large string constants faster than Python:
     161. it would be a lot faster for large numbers since MPIR is asymptotically faster than Python:
    1717{{{
    1818sage: s="1" + "0"*10000
    19 sage: timeit("""eval("%s")""" % s)
    20 625 loops, best of 3: 751 µs per loop
     19sage: timeit("""eval('Integer(%s)')""" % s)
     20625 loops, best of 3: 761 µs per loop
    2121sage: timeit("""eval('Integer("%s")')""" % s)
    2222625 loops, best of 3: 151 µs per loop
    2323}}}
     24For small numbers, there is a slight slowdown though:
     25{{{
     26sage: s="1000"
     27sage: timeit("""eval('Integer(%s)')""" % s)
     28625 loops, best of 3: 9.56 µs per loop
     29sage: timeit("""eval('Integer("%s")')""" % s)
     30625 loops, best of 3: 11 µs per loop
     31}}}
    2432
    25332. It solves #17807: thanks to #17413, entering `0100` will give a deprecation warning so at users should know something funny is going on when they enter `0100`.