Serhiy Storchaka added the comment: > > The cache of size 2 x 256 slots can increase memory consumption by 50 KiB > > in worst case, 2 x 1024 -- by 200 KiB. > How much is this compared to the total usage?
For Python interpreter VmSize: 31784 kB, VmRSS: 7900 kB. The cache doesn't affect performance of encode/decode since codecs are written in C. But it affects text processing written in Python. The more complex text processing code the less relative difference. $ ./python -m perf timeit --compare-to ./python0 -s 'import html; s = open("36248-0.txt").read()' -- 'html.escape(s)' Mean +- std dev: [python0] 2.59 ms +- 0.06 ms -> [python] 1.58 ms +- 0.04 ms: 1.64x faster (-39%) $ ./python -m perf timeit --compare-to ./python0 -s 'import re; s = open("36248-0.txt").read()' -- 're.escape(s)' Mean +- std dev: [python0] 45.9 ms +- 1.3 ms -> [python] 44.0 ms +- 1.4 ms: 1.04x faster (-4%) $ ./python -m perf timeit --compare-to ./python0 -s 'import fnmatch; s = open("36248-0.txt").read()' -- 'fnmatch.translate(s)' Mean +- std dev: [python0] 448 ms +- 9 ms -> [python] 435 ms +- 9 ms: 1.03x faster (-3%) $ ./python -m perf timeit --compare-to ./python0 -s 'import re, sre_compile; s = re.escape(open("36248-0.txt").read())' -- 'sre_compile.compile(s)' Mean +- std dev: [python0] 1.44 sec +- 0.02 sec -> [python] 1.41 sec +- 0.02 sec: 1.01x faster (-1%) $ ./python -m perf timeit --compare-to ./python0 -s 'import textwrap; s = open("36248-0.txt").read()' -- 'textwrap.wrap(s)' Mean +- std dev: [python0] 208 ms +- 2 ms -> [python] 207 ms +- 2 ms: 1.01x faster (-1%) In real-word applications I expect hundredths and thousandths fractions of percent. This effect can't be measured in any sane way. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31484> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com