Why is lambda so slow?

Michael Chermside mcherm at mcherm.com
Mon Jun 9 15:53:11 CEST 2003

> Dear people,
>     What's the reason of lambda being so slow?
> zeallous

Dear zeallous:

You are mistaken, lambda isn't slow. Why, I tried it on my system,
and the following program:

>>> f = lambda x: x + 1
>>> for i in range(112):
...     y = f(2)

ran in less than 5 seconds on my machine. That's well over 100
lambdas, that got run in less time than it took me to get my
smallest hourglass flipped over! Seems pretty fast to me.

If you had a particular situation in which you found lambda
was too slow for your use, then I might be able to comment more
helpfully on your specific situation.

-- Michael Chermside

More information about the Python-list mailing list