Skip to content

Comment on Announcing Pyston: an upcoming, JIT-based Python implementationparent

Comments

"Everytime you add two objects in Python you have the possibility of hitting a system defined add, or __add__ or __getattr__ or __getattribute__, or __radd__, or __getattr__ (looking for __radd__), etc"

That's pretty much a solved problem. Lookup the method once, cache it for next time, deoptimize if you're wrong or the definition of the class changes. If it keeps changing build up a larger cache.

Ruby has exactly the same behaviour, and we can still get it down to really simple machine code http://www.chrisseaton.com/rubytruffle/how-method-dispatch-w....

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.