New submission from STINNER Victor: In issue #21118, I optimized str.translate() in Python 3.5 for ASCII 1:1 mapping and ASCII deletion. My optimization is not used if a character is replaced with a string (ex: "abc".translate({ord('a'): "xxx"})) and for non-ASCII strings.
translate_script.py is a simple benchmark for 1:1 mapping. It should be enhanced to benchmark also replacement strings. ---------- files: translate_script.py messages: 215677 nosy: haypo, serhiy.storchaka priority: normal severity: normal status: open title: Optimize str.translate() for replacement with substrings and non-ASCII strings type: performance versions: Python 3.5 Added file: http://bugs.python.org/file34745/translate_script.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21165> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com