This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients benjamin.peterson, ezio.melotti, lemburg, methane, serhiy.storchaka, terry.reedy, vstinner, xiang.zhang
Date 2017-09-17.10:22:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505643725.7.0.0626077399743.issue31484@psf.upfronthosting.co.za>
In-reply-to
Content
> > 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.
History
Date User Action Args
2017-09-17 10:22:05serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, terry.reedy, vstinner, benjamin.peterson, ezio.melotti, methane, xiang.zhang
2017-09-17 10:22:05serhiy.storchakasetmessageid: <1505643725.7.0.0626077399743.issue31484@psf.upfronthosting.co.za>
2017-09-17 10:22:05serhiy.storchakalinkissue31484 messages
2017-09-17 10:22:05serhiy.storchakacreate