Skip to content

Instantly share code, notes, and snippets.

@PierreQuentel
Created April 7, 2015 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PierreQuentel/dfb9e1c3e60046ebc288 to your computer and use it in GitHub Desktop.
Save PierreQuentel/dfb9e1c3e60046ebc288 to your computer and use it in GitHub Desktop.
Benchmark with a loop on lists of strings instead of range()
Code for CPython, Brython and Skulpt : https://gist.github.com/PierreQuentel/50047f7d15b2e7d41516
Code for pypy.js : https://gist.github.com/PierreQuentel/d9b2c037089cd7361d42
| x slower than Cpython
Cpython Brython pypy.js skulpt | Brython pypy.js skulpt
assignment 112 1175 3961 5494 | 10.52 35.45 49.18
augm_assign 185 1744 4721 6533 | 9.42 25.51 35.30
assignment_float 117 2244 4112 5795 | 19.23 35.23 49.65
build_dict 369 7582 4398 13805 | 20.53 11.91 37.38
set_dict_item 188 1495 5492 22455 | 7.95 29.20 119.40
build_list 306 1405 4112 6677 | 4.59 13.42 21.79
set_list_item 176 1596 4033 8047 | 9.06 22.88 45.67
add_integers 303 2396 4743 6829 | 7.90 15.63 22.51
add_strings 396 3362 5286 7766 | 8.49 13.34 19.60
str_of_int 407 928 4389 14412 | 2.28 10.78 35.39
create_function 248 7448 4524 7899 | 30.08 18.27 31.91
function_call 324 13549 4248 21985 | 41.86 13.12 67.92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment