Nathaniel Smith <n...@pobox.com> added the comment: Please insert the usual caveats around how reliable benchmarking is impossible. (Last month when I tried this with a previous version of the patch, the interpreter that had the patch applied -- and thus was doing slightly *more* work -- was consistently a few percent faster in general, because something something PGO I guess? Compilers are weird.)
That said, I'm not seeing any measurable difference at all with this patch. This isn't surprising: in the default mode (tracking disabled), the extra operations are: coroutine creation: 'if (predictably_true) { self->a = NULL; self->b = NULL }' send/throw: 'if (genobject->ob_type == PyCoro_Type && self->a != NULL) { /* not executed, because the condition always fails */ }' ----- benchmark details I built 3954f6126f (head of my PR branch, labeled "with-unawaited-coroutines" below) and f23746a934 (its immediate parent, on master, labeled "without-unawaited-coroutines" below), with --enable-optimizations, on a Thinkpad T450s running 64-bit Linux. I ran a script (included below) that simply created and executed a trivial coroutine over and over, and measured using perf. 2 runs of each, alternating: ~/src/cpython$ without-unawaited-tracking/install/bin/python3 corobench.py ..................... coroutine creation/close: Mean +- std dev: 3.90 us +- 0.11 us ~/src/cpython$ with-unawaited-tracking/install/bin/python3 corobench.py ..................... coroutine creation/close: Mean +- std dev: 3.90 us +- 0.09 us ~/src/cpython$ without-unawaited-tracking/install/bin/python3 corobench.py ..................... coroutine creation/close: Mean +- std dev: 3.93 us +- 0.21 us ~/src/cpython$ with-unawaited-tracking/install/bin/python3 corobench.py ..................... coroutine creation/close: Mean +- std dev: 3.91 us +- 0.10 us Script: attached as "corobench.py" ---------- Added file: https://bugs.python.org/file47405/corobench.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue30491> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com