[issue7622] [patch] improve unicode methods: split() rsplit() and replace()
Florent Xicluna
report at bugs.python.org
Mon Jan 4 16:25:52 CET 2010
Florent Xicluna <laxyf at yahoo.fr> added the comment:
And now, the figures.
There's no gain for the string methods.
Some unicode methods are faster: split/rsplit/replace:
Most significant results:
--- bench_slow.log Trunk
+++ bench_fast.log Patched
string unicode
(ms) (ms) comment
========== late match, 100 characters
-13.30 20.51 s="ABC"*33; ("E"+s+("D"+s)*500).rsplit("E"+s, 1) (*100)
-16.12 29.88 s="ABC"*33; ((s+"D")*500+s+"E").split(s+"E", 1) (*100)
+13.27 14.38 s="ABC"*33; ("E"+s+("D"+s)*500).rsplit("E"+s, 1) (*100)
+16.19 17.61 s="ABC"*33; ((s+"D")*500+s+"E").split(s+"E", 1) (*100)
========== quick replace multiple character match
-4.51 159.78 ("A" + ("Z"*128*1024)).replace("AZZ", "BBZZ", 1) (*100)
+3.67 7.30 ("A" + ("Z"*128*1024)).replace("AZZ", "BBZZ", 1) (*100)
========== quick replace single character match
-3.73 50.61 ("A" + ("Z"*128*1024)).replace("A", "BB", 1) (*100)
+3.72 7.18 ("A" + ("Z"*128*1024)).replace("A", "BB", 1) (*100)
(full benchmark diff is attached)
And we save 1000 lines of code cumulated
(stringobject.c/unicodeobject.c/bytearrayobject.c)
----------
Added file: http://bugs.python.org/file15736/benchmark_split_replace.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7622>
_______________________________________
More information about the Python-bugs-list
mailing list