New submission from Sebastian Berg <sebast...@sipsolutions.net>:
The keyword argument extraction/finding function seems to have a performance bug/enhancement (unless I am missing something here). It reads: ``` for (i=0; i < nkwargs; i++) { PyObject *kwname = PyTuple_GET_ITEM(kwnames, i); /* ptr==ptr should match in most cases since keyword keys should be interned strings */ if (kwname == key) { return kwstack[i]; } assert(PyUnicode_Check(kwname)); if (_PyUnicode_EQ(kwname, key)) { return kwstack[i]; } } ``` However, it should be split into two separate for loops, using the `PyUnicode_EQ` check only if it failed for _all_ other arguments. I will open a PR for this (it seemed like a bpo number is wanted for almost everything. ---------- components: C API messages: 358287 nosy: seberg priority: normal severity: normal status: open title: ENH: Fix performance issue in keyword extraction versions: Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39028> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com