Ezio Melotti added the comment: Attached new benchmark file.
Results: Testing runtime of the _has_surrogates functions Generating chars... Generating samples... 1.61 <- re.compile(current_regex).search 0.24 <- re.compile(short_regex).search 15.13 <- return any(c in surrogates for c in s) 10.21 <- for c in s: if c in surrogates: return True 0.85 <- return re.search(short_regex, s) 0.83 <- functools.partial(re.search, short_regex) 20.86 <- for c in map(ord, s): if c in range(0xDC80, 0xDCFF+1): return True 19.68 <- for c in map(ord, s): if 0xDC80 <= c <= 0xDCFF: return True 0.28 <- re.compile('[^\udc80-\udcff]*\Z').match 7.00 <- return not set(map(chr, range(0xDC80, 0xDCFF+1))).isdisjoint(s) Testing startup time 0.57 <- r = re.compile('[\udc80-\udcff]').search 0.59 <- r = re.compile('[^\udc80-\udcff]*\Z').match 199.79 <- r = re.compile('[\udc80-\udcff]').search; purge() 22.62 <- r = re.compile('[^\udc80-\udcff]*\Z').match; purge() 1.12 <- r = pickle.loads(p) ---------- Added file: http://bugs.python.org/file27225/issue11454_benchmarks.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11454> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com