9 ms·
That code should only create the dict/namedtuple instance once, then access it many, many times. The creation occurs in the --setup portion. The field accesses
by mjschultz 13y ago
That code should only create the dict/namedtuple instance once, then access it many, many times.
The creation occurs in the --setup portion. The field accesses occur in the actual looping portion of the timeit code.
- pdonis 13y agoAh, ok, I see, for some reason my browser wasn't showing the namedtuple code snippet right. Now I need to go look at the namedtuple code to see why accessing the fields by name is slower than accessing them by index.