[Python-Dev] More optimisation ideas
Serhiy Storchaka
storchaka at gmail.com
Sat Jan 30 09:45:44 EST 2016
More information about the Python-Dev mailing list
Sat Jan 30 09:45:44 EST 2016
- Previous message (by thread): [Python-Dev] More optimisation ideas
- Next message (by thread): [Python-Dev] More optimisation ideas
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 29.01.16 19:05, Steve Dower wrote: > This is probably the code snippet that bothered me the most: > > ### Encoding table > encoding_table=codecs.charmap_build(decoding_table) > > It shows up in many of the encodings modules, and while it is not a bad > function in itself, we are obviously generating a known data structure > on every startup. Storing these in static data is a tradeoff between > disk space and startup performance, and one I think it likely to be > worthwhile. $ ./python -m timeit -s "import codecs; from encodings.cp437 import decoding_table" -- "codecs.charmap_build(decoding_table)" 100000 loops, best of 3: 4.36 usec per loop Getting rid from charmap_build() would save you at most 4.4 microseconds per encoding. 0.0005 seconds if you have imported *all* standard encodings! And how you expected to store encoding_table in more efficient way?
- Previous message (by thread): [Python-Dev] More optimisation ideas
- Next message (by thread): [Python-Dev] More optimisation ideas
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list