gtn/.venv/Lib/site-packages/mypyc/doc/cpython-timings.md
Tipragot 628be439b8 Ajout d'un environement de développement.
Cela permet de ne pas avoir de problèmes de compatibilité
car python est dans le git.
2023-10-26 15:33:03 +02:00

830 B

Timings of CPython Operations

Here are some very rough approximate timings of CPython interpreter operations:

  • f(1) (empty function body): 70-90ns
  • f(n=1) (empty function body): 90-110ns
  • o.x: 30-40ns
  • o.f(1) (empty method body): 80-160ns
  • Cls(1) (initialize attribute in __init__): 290-330ns
  • x + y (integers): 20-35ns
  • a[i] (list) : 20-40ns
  • [i] (also dealloc): 35-55ns
  • a.append(i) (list, average over 5 appends): 70ns
  • d[s] (dict, shared str key): 20ns
  • d[s] = i (dict, shared str key): 40ns
  • isinstance(x, A): 100ns
  • (x, y): 20-35ns
  • x, y = t (tuple expand): 10ns

Note that these results are very imprecise due to many factors, but these should give a rough idea of the relative costs of various operations.

Details: CPython 3.6.2, Macbook Pro 15" (Mid 2015), macOS Sierra