[pypy-dev] Poor performance with custom bytecode

Amaury Forgeot d'Arc amauryfa at gmail.com
Fri Feb 17 16:24:24 CET 2012


2012/2/17 Timothy Baldridge <tbaldridge at gmail.com>

> Basically I got to the point where I realized that if I had lisp
> macros, I could write RPython code way faster. Half of the structures
> in Clojure follow this pattern:
>
> class Foo(object):
>    def __init__(self, foo bar, baz):
>         self.foo = foo
>         self.bar = bar
>         self.baz = baz
>    def addBarBaz(self):
>         return bar + baz
>
> I could write that for that, or, in Clojure I could write myself a
> macro and just do:
>
> (deftype Foo [foo bar baz]
>      (addBarBaz[self] (+ bar baz)))
>

Remember that RPython works with imported modules, on classes and functions
in memory.
You are free to use exec() or eval() to build code.


-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120217/4b2d428d/attachment.html>


More information about the pypy-dev mailing list