[pypy-svn] r49318 - pypy/dist/pypy/translator/microbench

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Dec 3 17:43:15 CET 2007


Author: cfbolz
Date: Mon Dec  3 17:43:14 2007
New Revision: 49318

Modified:
   pypy/dist/pypy/translator/microbench/test_unicode.py
Log:
some more find microbenches. python2.4 is marginally faster than pypy here and
python2.5 is tons faster. we should steal their algorithm:

http://effbot.org/zone/stringlib.htm


Modified: pypy/dist/pypy/translator/microbench/test_unicode.py
==============================================================================
--- pypy/dist/pypy/translator/microbench/test_unicode.py	(original)
+++ pypy/dist/pypy/translator/microbench/test_unicode.py	Mon Dec  3 17:43:14 2007
@@ -3,3 +3,38 @@
 u1 = (u"not the xyz" * N)
 def test_find_worstcase():
     u1.find(u"not there")
+
+def test_count_worstcase():
+    u1.count(u"not there")
+
+u2 = (u"aaa" * 1000)
+def test_find_pattern16():
+    i = 1
+    while i < N:
+        i += 1
+        u2.find(u"bbbbbbbbbbbbbbbb")
+
+def test_find_pattern8():
+    i = 1
+    while i < N:
+        i += 1
+        u2.find(u"bbbbbbbb")
+
+def test_find_pattern4():
+    i = 1
+    while i < N:
+        i += 1
+        u2.find(u"bbbb")
+
+def test_find_pattern2():
+    i = 1
+    while i < N:
+        i += 1
+        u2.find(u"bb")
+
+
+def test_find_pattern1():
+    i = 1
+    while i < N:
+        i += 1
+        u2.find(u"b")



More information about the Pypy-commit mailing list