consider this little program: import time, sre k =3D u"foo" p =3D sre.compile(k) s =3D "*"*500 + k + "*"*500 def f1(): p.search(s) def f2(): s.find(k) def bench(f): t0 =3D time.clock() for i in range(100000): f() print f, time.clock() - t0 bench(f1) bench(f2) which prints: <function f1 at 7a0680> 2.94704487169 <function f2 at 7a06a0> 10.5247875425 (Windows 95, 233 MHz) if I change the k variable to an 8-bit string, it prints: <function f1 at 7a0740> 2.47613520173 <function f2 at 7a0760> 2.5178698939 (for some reason, sre is still slighty faster...) so in other words, something in unicode land isn't as efficient as it should... </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4