Florent Xicluna <la...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue7622> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com