On 15.09.16 11:02, INADA Naoki wrote:
Are two Pythons built with same options?

Both are built from clean checkout with default options (hg update -C 3.x; ./configure; make -s). The only difference is -std=c99 and additional warnings in 3.6:

Python 3.5:
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -I./Include -DPy_BUILD_CORE -o Objects/dictobject.o Objects/dictobject.c

Python 3.6:
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -DPy_BUILD_CORE -o Objects/dictobject.o Objects/dictobject.c

Usually I run a microbenchmark 3-5 times and choose the median. Results was stable enough (the variation is about 1%), unlikely the perf tool will give significantly different result.

I repeated measurements on different computer, the difference is the same:

Python 3.5: 10 loops, best of 3: 33.5 msec per loop
Python 3.6: 10 loops, best of 3: 37.5 msec per loop

These results look surprisingly and inexplicably to me. I expected that even if there is some performance regression in the lookup or modifying operation, the iteration should not be slower.

CPUs on both computers work in 32-bit mode. Maybe this affects.


For string keys Python 3.6 is 4 times faster!

$ ./python -m timeit -s "d = dict.fromkeys(map(str, range(10**6)))" -- "list(d)"

On one computer:
Python 3.5: 10 loops, best of 3: 384 msec per loop
Python 3.6: 10 loops, best of 3: 94.6 msec per loop

On other computer:
Python 3.5: 10 loops, best of 3: 179 msec per loop
Python 3.6: 10 loops, best of 3: 46 msec per loop


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to