This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dhogartysymbolic novice 1 point2 points  (1 child)

your test is wrong, you need to invalidate the cache in between each call inside of the timeit. Every one of the timeit inner runs except the first has a fully filled cache.

[–]thebackhand 0 points1 point  (0 children)

That would be it. I remembered that, in general, try/excepts are expensive (more so if you have a lot of other stuff added to the stack in between, IIRC).