[Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered (original) (raw)
INADA Naoki songofacandy at gmail.com
Thu Sep 15 05:23:02 EDT 2016
- Previous message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Next message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Sep 15, 2016 at 5:57 PM Victor Stinner <victor.stinner at gmail.com> wrote:
2016-09-15 10:02 GMT+02:00 INADA Naoki <songofacandy at gmail.com>: > In my environ: > > ~/local/python-master/bin/python3 -m timeit -s "d = > dict.fromkeys(range(10**6))" 'list(d)'
Stooooop! Please stop using timeit, it's lying! * You must not use the minimum but average or median * You must run a microbenchmark in multiple processes to test different randomized hash functions and different memory layouts In short: you should use my perf module. http://perf.readthedocs.io/en/latest/cli.html#timeit I'm sorry. Changing habit is bit difficult. I'll use it in next time.
I ran microbench 3~5 times and confirm the result is stable before posting result. And when difference is smaller than 10%, I don't believe the result.
The memory layout and the hash function have a major important on such microbenchmark: https://haypo.github.io/journey-to-stable-benchmark-average.html
In this microbench, hash randomization is not important, because key of dict is int. (It means iterating dict doesn't cause random memory access in old dict implementation too.)
> Both Python is built without neither
--with-optimizations
ormake_ _> profile-opt
. That's bad :-) For most reliable benchmarks, it's better to use LTO+PGO compilation.
LTO+PGO may make performance of git pull && make
unstable.
PGO clean build takes tooo long time for such a quick benchmark.
So I don't want to use PGO in such a quick benchmark.
And Python doesn't provide way to use LTO without PGO.... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160915/38b684a4/attachment.html>
- Previous message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Next message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]