On Tue, 11 Jun 2013 20:03:45 +0600, Stefan Behnel <stefan...@behnel.de>
wrote:
Nikita Nemkin, 11.06.2013 13:51:
Pure Python functions rarely benefit from compilation. I thought it
would be interesting to add an "interpreted" directive (global,
module, class, function level + automatic heuristic) that will
instruct Cython to compile def functions into _bytecode_ and store
that bytecode in the binary.
Together with module bundling and embed/freeze it could make a neat
deployment solution.
Well, it shouldn't be all that hard to implement. Basically, we'd send a
part of the source file through the Python parser after having parsed and
processed it in the compiler.
However, I fail to see the advantage of this feature that would make it
worth providing to users. There usually *is* a visible performance
advantage of compiled code over pure Python code, and the advantages of
interpreted Python code in terms of semantics or compatibility are quite
limited (debugging, maybe, or introspection).
Let's just say there are legitimate reasons to stay interpreted,
binary size and compatibility among them.
Could you describe how/why you came up with this?
Well, I was wondering why isn't CPython written in Cython
(actually I know why) and how awesome it would be to have a
system with CPython runtime and unified Cython/Python compiler
front-end targeting both bytecode and native code.
In such system, per-function compiled/interpreted switch would
feel natural to me...
That's how, if it answers your question.
And from a different angle: many people praise Go(lang) for it's
"single fat binary" deployment approach.
First class bytecode support in Cython colud provide the same
for Python. (Maybe not quite the same, but a step in this direction.)
Best regards,
Nikita Nemkin
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel