[pypy-dev] Jit hints from python

Timothy Baldridge tbaldridge at gmail.com
Thu May 24 20:07:38 CEST 2012


> Note that already nowadays you can hack (maybe we should just make
> such hacks more explicit): if you use not a general-purpose dictionary
> but instead a namespace like a module or a class, then reads are
> constant-folded with an out-of-line guard.  This means you could
> rewrite your code for example like this:

You're right, that gives me a bout a 5x speedup from by
micro-benchmarks. The only problem is that module and class only
accept strings as attribute keys. So we have to do something like
type(args[0]).__name__ which is kindof hack-ish.

At any rate, I'm playing around with writing Clojure as a pypy module.
Last night (and this morning) I got this class (PolymorphicFn)
implemented as an interpreter level object with a App level Typedef.
Clojure defines several function types that would see a rather good
performance gain from being more tightly integrated with the
interpreter. For example, Clojure defines multi-arity functions,
variadic functions, multi-methods, etc. The performance gains of
handling these on an interpreter level interest me, so I'm going to
see where this rabbit hole leads.

Timothy


More information about the pypy-dev mailing list