Hacker News new | past | comments | ask | show | jobs | submit login
LLVM Python (llvmpy.org)
69 points by X4 on Sept 22, 2013 | hide | past | favorite | 16 comments



Extra info: these bindings are what Numba is built on. That's why it's maintained by Continuum Analytics, the people behind Numba.


In particular, a lot of was written by Siu Kwan Lam (https://github.com/sklam), who doesn't seem prone to taking public credit but has been quietly doing an awesome job.


Based on the word shape of the domain, please tell me that this is pronounced "lumpy."

If not, it should be.


"llvmpy" kind of looks like an Ancient Roman trying to write down a Welsh word.

And for good reason: The 'v' glyph was used for both the 'v' sound and the vowel 'u' sound before 'u' became its own letter.


I'm curious, is there a Python to native executives compiler/builder?


Yes, Nuitka (http://nuitka.net/) and Cython (http://cython.org/) both compile a Python program to a chain of C API calls. The performance benefit isn't typically all that large, since removing dispatch overhead isn't really a huge deal compared to using more efficient data representations. Cython has the additional benefit that it lets you declare some typing assumptions, which then enables serious performance gains.

There are also runtime compilers for Python subsets such as Numba (http://numba.pydata.org/) and Parakeet (https://github.com/iskandr/parakeet), which can potentially give you huge speedups (as long as you stay within the world of numerical/array-oriented code).


I have experience with Cython, and it works pretty well -- you basically use python code, but add some type hints and it will compile and get quite faster. Of course, it will not be as fast as normal C, because it still uses smarter (but slower) Python data structures, but it provides nice middle ground between pure python or PyPy, and writing the performance critical-part of your software in C by hand, which is bit more work, especially if you need to transfer multidimensional arrays between C and Python.


Can you use this to write, say, high-performance webapps and/or database drivers?


You can use any Python to write high-performance webapps cause the performance requirements for "webapps" is low and the backends are usually servers/services and/or are more constrained by datastructures/algorithm/disk than execution speed.


I think you might have evaded the question :-).

There really are some "webapps" with tight performance requirements. For example, Google's web frontend is a statically compiled C++ application. And yes, anithero, you could write that sort of thing in Cython and with some type declarations get acceptable native performance. You will probably miss a few opportunities for optimization but catch the low-hanging fruit and get an orders of magnitude speedup over Python.


Interesting. I was actually thinking of using something like this to take parts of the slower web frameworks that have tonnes of functionality, such as Django's ORM or templating, and get them on par with microframeworks.


I think you may have shedskin ( https://code.google.com/p/shedskin/ ).

I seem to remember performance wise the RPython guys seems to think a JIT implementation of Python would be faster because of the dynamic nature of Python.


Does this mean, that we're able to translate python into javascript with emscripten or is there additional work to do? (https://github.com/kripken/emscripten/wiki)

Edit: Furthermore, how practical is this?


This is not a compiler that does python -> llvm. It is a way to build llvm IR from python using the C++ API. Otherwise you output LLVM IR as text, and call the llvm command line tools to do stuff with it.

For example, you can use this to generate LLVM IR at runtime, and use the LLVM JIT to compile and execute that LLVM code.


for a moment there i thought this was a new attempt at unladen swallow... [if you've not clicked, it's a python lib to access llvm tools]

http://qinsb.blogspot.com/2011/03/unladen-swallow-retrospect...


Nice tooling for writing compilers. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: