Yurii Karabas <1998uri...@gmail.com> added the comment:
I have run tests with different types of function declaration. A function declaration with annotations is more than 2 times faster with the co_annotatins feature. If function doesn't have annotations time almost same as without co_annotatins feature. Results: ``` def foo(x: int, /, y, *, z: float) -> int: pass Python 3.8.3 5000000 loops, best of 5: 178 nsec per loop Python 3.9.0 5000000 loops, best of 5: 210 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 122 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 53.3 nsec per loop def f(a: int, /, b: int, *, c: int) -> None: pass Python 3.8.3 5000000 loops, best of 5: 208 nsec per loop Python 3.9.0 5000000 loops, best of 5: 235 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 139 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 53.2 nsec per loop def f(a: int, /, b: int, *, c: int, **d: int) -> None: pass Python 3.8.3 5000000 loops, best of 5: 224 nsec per loop Python 3.9.0 5000000 loops, best of 5: 257 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 167 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 55.9 nsec per loop def f(a: int, b: str) -> None: pass Python 3.6.8 5000000 loops, best of 3: 0.163 usec per loop Python 3.7.6 5000000 loops, best of 5: 165 nsec per loop Python 3.8.3 5000000 loops, best of 5: 165 nsec per loop Python 3.9.0 5000000 loops, best of 5: 184 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 125 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 54.5 nsec per loop def f(a: int, *, b: int) -> None: pass Python 3.6.8 5000000 loops, best of 3: 0.166 usec per loop Python 3.7.6 5000000 loops, best of 5: 170 nsec per loop Python 3.8.3 5000000 loops, best of 5: 155 nsec per loop Python 3.9.0 5000000 loops, best of 5: 198 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 124 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 54.3 nsec per loop def f(a, /, b, *, c) -> None: pass Python 3.8.3 5000000 loops, best of 5: 90.1 nsec per loop Python 3.9.0 5000000 loops, best of 5: 96.3 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 93.8 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 55.5 nsec per loop def f(a, /, b, *, c, **d) -> None: pass Python 3.8.3 5000000 loops, best of 5: 92.3 nsec per loop Python 3.9.0 5000000 loops, best of 5: 98 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 92.6 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 54.4 nsec per loop def f(a, b) -> None: pass Python 3.6.8 5000000 loops, best of 3: 0.0966 usec per loop Python 3.7.6 5000000 loops, best of 5: 92.5 nsec per loop Python 3.8.3 5000000 loops, best of 5: 87.5 nsec per loop Python 3.9.0 5000000 loops, best of 5: 93.7 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 88.3 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 53 nsec per loop def f(a, *, b) -> None: pass Python 3.6.8 5000000 loops, best of 3: 0.0951 usec per loop Python 3.7.6 5000000 loops, best of 5: 92.4 nsec per loop Python 3.8.3 5000000 loops, best of 5: 86.6 nsec per loop Python 3.9.0 5000000 loops, best of 5: 93.6 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 89.8 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 53.6 nsec per loop def f(): pass Python 3.6.8 5000000 loops, best of 3: 0.0502 usec per loop Python 3.7.6 5000000 loops, best of 5: 47.7 nsec per loop Python 3.8.3 5000000 loops, best of 5: 47.9 nsec per loop Python 3.9.0 5000000 loops, best of 5: 46.7 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 50.8 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 52 nsec per loop def f(a, /, b, *, c): pass Python 3.8.3 5000000 loops, best of 5: 47.9 nsec per loop Python 3.9.0 5000000 loops, best of 5: 47.4 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 50.2 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 52.8 nsec per loop def f(a, /, b, *, c, **d): pass Python 3.8.3 5000000 loops, best of 5: 48.7 nsec per loop Python 3.9.0 5000000 loops, best of 5: 48.2 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 50.8 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 52.4 nsec per loop def f(a, b): pass Python 3.6.8 5000000 loops, best of 3: 0.0498 usec per loop Python 3.7.6 5000000 loops, best of 5: 48.5 nsec per loop Python 3.8.3 5000000 loops, best of 5: 47.5 nsec per loop Python 3.9.0 5000000 loops, best of 5: 47 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 51 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 52.6 nsec per loop def f(a, *, b): pass Python 3.6.8 5000000 loops, best of 3: 0.0498 usec per loop Python 3.7.6 5000000 loops, best of 5: 48.1 nsec per loop Python 3.8.3 5000000 loops, best of 5: 48.4 nsec per loop Python 3.9.0 5000000 loops, best of 5: 46.6 nsec per loop Python 3.10.0a2+ 5000000 loops, best of 5: 50.2 nsec per loop Python 3.10.0a2+ with co_annotations 5000000 loops, best of 5: 52.6 nsec per loop ``` ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42202> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com