Created
November 14, 2012 15:06
-
-
Save letoh/4072651 to your computer and use it in GitHub Desktop.
dict test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://www.doughellmann.com/articles/misc/dict-performance/ | |
| $ ./pypy-c --version | |
| Python 2.7.3 (e537e0093563, Oct 13 2012, 22:21:46) | |
| [PyPy 1.9.1-dev0 with GCC 4.4.4] | |
| $ ./pypy-c -m timeit -n 1000000 -r 5 -v 'dict()' | |
| raw times: 0.0186 0.00177 0.00134 0.00134 0.00234 | |
| 1000000 loops, best of 5: 0.00134 usec per loop | |
| $ ./pypy-c -m timeit -n 1000000 -r 5 -v '{}' | |
| raw times: 0.00387 0.00146 0.00234 0.00243 0.00142 | |
| 1000000 loops, best of 5: 0.00142 usec per loop | |
| $ ./pypy-c -m timeit -n 1000000 -r 5 -v 'dict(a="A", b="B", c="C")' | |
| raw times: 0.326 0.305 0.304 0.304 0.304 | |
| 1000000 loops, best of 5: 0.304 usec per loop | |
| $ ./pypy-c -m timeit -n 1000000 -r 5 -v '{"a": "A", "b": "B", "c": "C"}' | |
| raw times: 0.0153 0.00134 0.00134 0.00134 0.00212 | |
| 1000000 loops, best of 5: 0.00134 usec per loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment