1. 05 Oct, 2011 3 commits
    • Victor Stinner's avatar
      Speedup str[a:b] and PyUnicode_FromKindAndData · b9275c10
      Victor Stinner authored
       * str[a:b] doesn't scan the string for the maximum character if the string
         is ascii only
       * PyUnicode_FromKindAndData() stops if we are sure that we cannot use a
         shorter character type. For example, _PyUnicode_FromUCS1() stops if we
         have at least one character in range U+0080-U+00FF
      b9275c10
    • 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
    • Antoine Pitrou's avatar
      Fix text failures when ctypes is not available · 00b2c86d
      Antoine Pitrou authored
      (followup to Victor's 85d11cf67aa8 and 7a50e549bd11)
      00b2c86d
  2. 04 Oct, 2011 37 commits