Message302362
> > 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. |
|
Date |
User |
Action |
Args |
2017-09-17 10:22:05 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, lemburg, terry.reedy, vstinner, benjamin.peterson, ezio.melotti, methane, xiang.zhang |
2017-09-17 10:22:05 | serhiy.storchaka | set | messageid: <1505643725.7.0.0626077399743.issue31484@psf.upfronthosting.co.za> |
2017-09-17 10:22:05 | serhiy.storchaka | link | issue31484 messages |
2017-09-17 10:22:05 | serhiy.storchaka | create | |
|