• Victor Stinner's avatar
    Speedup the ASCII decoder · 702c7343
    Victor Stinner authored
    It is faster for long string and a little bit faster for short strings,
    benchmark on Linux 32 bits, Intel Core i5 @ 3.33GHz:
    
    ./python -m timeit 'x=b"a"' 'x.decode("ascii")'
    ./python -m timeit 'x=b"x"*80' 'x.decode("ascii")'
    ./python -m timeit 'x=b"abc"*4096' 'x.decode("ascii")'
    
    length |   before   | after
    -------+------------+-----------
         1 | 0.234 usec | 0.229 usec
        80 | 0.381 usec | 0.357 usec
    12,288 |  11.2 usec |  3.01 usec
    702c7343
unicodeobject.c 410 KB