Message170715
Startup-time:
$ ./python -m timeit -s 'import re' 're.compile("([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)").search; re.purge()'
100 loops, best of 3: 4.16 msec per loop
$ ./python -m timeit -s 'import re' 're.purge()' 're.compile("[\udc80-\udcff]").search'
100 loops, best of 3: 5.72 msec per loop
$ ./python -m timeit 'h=lambda s, p=set(map(chr, range(0xDC80, 0xDCFF+1))): any(c in p for c in s)'
10000 loops, best of 3: 60.5 usec per loop
$ ./python -m timeit -s 'import re' 're.purge()' 're.compile("(?![^\udc80-\udcff])").search'
1000 loops, best of 3: 401 usec per loop
$ ./python -m timeit -s 'import re' 're.purge()' 're.compile("[^\udc80-\udcff]*\Z").match'
1000 loops, best of 3: 427 usec per loop
Runtime:
$ ./python -m timeit -s 'import re; h=re.compile("([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)").search; s = "A"*1000' 'h(s)'
1000 loops, best of 3: 245 usec per loop
$ ./python -m timeit -s 'import re; h=re.compile("[\udc80-\udcff]").search; s = "A"*1000' 'h(s)'
10000 loops, best of 3: 30.1 usec per loop
$ ./python -m timeit -s 'h=lambda s, p=set(map(chr, range(0xDC80, 0xDCFF+1))): any(c in p for c in s); s = "A"*1000' 'h(s)'
10000 loops, best of 3: 164 usec per loop
$ ./python -m timeit -s 'import re; h=re.compile("(?![^\udc80-\udcff])").search; s = "A"*1000' 'h(s)'
10000 loops, best of 3: 98.3 usec per loop
$ ./python -m timeit -s 'import re; h=re.compile("[^\udc80-\udcff]*\Z").match; s = "A"*1000' 'h(s)'
10000 loops, best of 3: 34.6 usec per loop |
|
Date |
User |
Action |
Args |
2012-09-19 09:29:39 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, loewis, barry, orsenthil, nadeem.vawda, ezio.melotti, r.david.murray, rosslagerwall |
2012-09-19 09:29:39 | serhiy.storchaka | set | messageid: <1348046979.1.0.979049570522.issue11454@psf.upfronthosting.co.za> |
2012-09-19 09:29:38 | serhiy.storchaka | link | issue11454 messages |
2012-09-19 09:29:38 | serhiy.storchaka | create | |
|