[Python-Dev] More optimisation ideas (original) (raw)
Steve Dower steve.dower at python.org
Sat Jan 30 11:31:32 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 30Jan2016 0645, Serhiy Storchaka wrote:
$ ./python -m timeit -s "import codecs; from encodings.cp437 import decodingtable" -- "codecs.charmapbuild(decodingtable)" 100000 loops, best of 3: 4.36 usec per loop
Getting rid from charmapbuild() would save you at most 4.4 microseconds per encoding. 0.0005 seconds if you have imported all standard encodings!
Just as happy to be proven wrong. Perhaps I misinterpreted my original profiling and then, embarrassingly, ran with the result for a long time without retesting.
And how you expected to store encodingtable in more efficient way?
There's nothing inefficient about its storage, but as it does not change it would be trivial to store it statically. Then "building" the map is simply obtaining a pointer into an already loaded memory page. Much faster than building it on load, but both are clearly insignificant compared to other factors.
Cheers, Steve
- 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 ]