[pypy-commit] pypy unicode-utf8: small improvements
fijal
pypy.commits at gmail.com
Wed Dec 6 14:01:17 EST 2017
Author: fijal
Branch: unicode-utf8
Changeset: r93287:f6b0e685b84d
Date: 2017-12-06 21:00 +0200
http://bitbucket.org/pypy/pypy/changeset/f6b0e685b84d/
Log: small improvements
diff --git a/unicode-bench.py b/unicode-bench.py
--- a/unicode-bench.py
+++ b/unicode-bench.py
@@ -6,6 +6,9 @@
unicodes = [unicode("u" * LGT + str(i)) for i in range(100)]
non_ascii_unicodes = [u"u" * LGT + unicode(i) + u"å" for i in range(100)]
+long_string = u" " * 1000000
+unicodes = [long_string] * 100
+
RANGE = 250000000 // LGT
def upper(main_l):
@@ -38,11 +41,37 @@
for i in xrange(RANGE):
l[0] = main_l[i % 100].find(u"foo")
-for func in [upper]:#, lower, isupper, islower]:
+def split(main_l):
+ l = [None]
+ for i in xrange(RANGE):
+ l[0] = main_l[i % 100].split()
+
+def splitlines(main_l):
+ l = [None]
+ for i in xrange(RANGE):
+ l[0] = main_l[i % 100].splitlines()
+
+def iter(main_l):
+ l = [None]
+ for i in xrange(RANGE // 10000):
+ for elem in main_l[i % 100]:
+ l[0] = elem
+
+def indexing(main_l):
+ l = [None]
+ for i in xrange(RANGE * 10):
+ l[0] = main_l[i % 100][13]
+
+def isspace(main_l):
+ l = [None]
+ for i in xrange(RANGE // 10000):
+ l[0] = main_l[i % 100].isspace()
+
+for func in [isspace]:#, lower, isupper, islower]:
t0 = time.time()
func(unicodes)
t1 = time.time()
print "ascii %s %.2f" % (func.__name__, t1 - t0)
- func(non_ascii_unicodes)
- t2 = time.time()
- print "non-ascii %s %.2f" % (func.__name__, t2 - t1)
+ #func(non_ascii_unicodes)
+ #t2 = time.time()
+ #print "non-ascii %s %.2f" % (func.__name__, t2 - t1)
More information about the pypy-commit
mailing list