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 methane
Recipients methane, rhettinger, serhiy.storchaka
Date 2017-08-23.15:27:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1503502021.16.0.384968153053.issue31265@psf.upfronthosting.co.za>
In-reply-to
Content
od.move_to_end() is slower too:

$ ./py-patched -m perf timeit --compare-to `pwd`/py-default -s 'from collections import OrderedDict as odict; od = odict.fromkeys("abcdefghijklmnopqrstuvwxyz")' -- 'od.move_to_end("a"); od.move_to_end("b")'
py-default: ..................... 196 ns +- 4 ns
py-patched: ..................... 227 ns +- 3 ns

Mean +- std dev: [py-default] 196 ns +- 4 ns -> [py-patched] 227 ns +- 3 ns: 1.16x slower (+16%)

$ ./py-patched -m perf timeit --compare-to `pwd`/py-default -s 'from collections import OrderedDict as odict; od = odict.fromkeys("abcdefghijklmnopqrstuvwxyz")' -- 'od.move_to_end("z")'
py-default: ..................... 74.7 ns +- 0.4 ns
py-patched: ..................... 91.1 ns +- 3.5 ns

Mean +- std dev: [py-default] 74.7 ns +- 0.4 ns -> [py-patched] 91.1 ns +- 3.5 ns: 1.22x slower (+22%)

$ ./py-patched -m perf timeit --compare-to `pwd`/py-default -s 'from collections import OrderedDict as odict; od1 = odict.fromkeys(range(10000)); od2=odict.fromkeys(range(10000))' -- 'od1==od2'
py-default: ..................... 451 us +- 3 us
py-patched: ..................... 632 us +- 6 us

Mean +- std dev: [py-default] 451 us +- 3 us -> [py-patched] 632 us +- 6 us: 1.40x slower (+40%)


# pros

* 1000 less lines of code
* 50% less memory usage
* 15% faster creation
* 100% (2x) faster iteration

# cons

* Some inconsistency against pure Python implementation
* 20% slower move_to_end
* 40% slower comparison
History
Date User Action Args
2017-08-23 15:27:01methanesetrecipients: + methane, rhettinger, serhiy.storchaka
2017-08-23 15:27:01methanesetmessageid: <1503502021.16.0.384968153053.issue31265@psf.upfronthosting.co.za>
2017-08-23 15:27:01methanelinkissue31265 messages
2017-08-23 15:27:00methanecreate