Message324395
In _PyFunction_FastCallDict we have local nk assigned to be the size of a dictionary, and then local i is assigned to twice the size of the same dictionary, and then nk is assigned to half of i, which it already is:
nk = (kwargs != NULL) ? PyDict_GET_SIZE(kwargs) : 0;
if (nk != 0) {
...
pos = i = 0;
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
...
i += 2;
}
nk = i / 2;
I am attempting to understand the performance characteristics of this hot path, and I spent far too long trying to figure out why nk was being assigned a value it already has. :)
I propose that the redundant store be replaced with an assertion that i/2 is equal to nk.
I will submit a pull request presently. |
|
Date |
User |
Action |
Args |
2018-08-30 17:27:21 | Eric Lippert | set | recipients:
+ Eric Lippert |
2018-08-30 17:27:21 | Eric Lippert | set | messageid: <1535650041.35.0.56676864532.issue34551@psf.upfronthosting.co.za> |
2018-08-30 17:27:21 | Eric Lippert | link | issue34551 messages |
2018-08-30 17:27:21 | Eric Lippert | create | |
|