2 ms·
Oh, your compiler doesn't have to be sufficiently smart. It merely has to avoid premature optimization: see this classic paper https://dspace.mit.edu/handle/17
by eru 6y ago
Oh, your compiler doesn't have to be sufficiently smart. It merely has to avoid premature optimization: see this classic paper https://dspace.mit.edu/handle/1721.1/5753 https://dspace.mit.edu/handle/1721.1/5753 by Guy Steele.
> I can't be sure without measuring, but I strongly suspect the overhead will be mostly in tuple packing/unpacking and GC.
I guess that's the same overhead as in this imperative version:
a, b = 0, 1
for _ in range(n):
a, b = b, a + b