Author serhiy.storchaka
Recipients barry, ezio.melotti, loewis, nadeem.vawda, orsenthil, r.david.murray, rosslagerwall, serhiy.storchaka
Date 2012-09-19.09:29:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348046979.1.0.979049570522.issue11454@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2012-09-19 09:29:39serhiy.storchakasetrecipients: + serhiy.storchaka, loewis, barry, orsenthil, nadeem.vawda, ezio.melotti, r.david.murray, rosslagerwall
2012-09-19 09:29:39serhiy.storchakasetmessageid: <1348046979.1.0.979049570522.issue11454@psf.upfronthosting.co.za>
2012-09-19 09:29:38serhiy.storchakalinkissue11454 messages
2012-09-19 09:29:38serhiy.storchakacreate