Author ezio.melotti
Recipients barry, ezio.melotti, loewis, nadeem.vawda, orsenthil, r.david.murray, rosslagerwall
Date 2012-09-19.02:46:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348022809.82.0.409326282992.issue11454@psf.upfronthosting.co.za>
In-reply-to
Content
re.compile seems twice as fast as pickle.loads:


import re
import pickle
import timeit

N = 100000
s = "r = re.compile('[\\udc80-\\udcff]')"
t = timeit.Timer(s, 'import re')
print("%6.2f <- re.compile" % t.timeit(number=N))

s = "r = pickle.loads(p)"
p = pickle.dumps(re.compile('[\udc80-\udcff]'))
t = timeit.Timer(s, 'import pickle; from __main__ import p')
print("%6.2f <- pickle.loads" % t.timeit(number=N))


Result:
  5.59 <- re.compile
 11.04 <- pickle.loads


See also #2679.
History
Date User Action Args
2012-09-19 02:46:49ezio.melottisetrecipients: + ezio.melotti, loewis, barry, orsenthil, nadeem.vawda, r.david.murray, rosslagerwall
2012-09-19 02:46:49ezio.melottisetmessageid: <1348022809.82.0.409326282992.issue11454@psf.upfronthosting.co.za>
2012-09-19 02:46:49ezio.melottilinkissue11454 messages
2012-09-19 02:46:49ezio.melotticreate