3 ms·
What you're describing is known as the "two language problem". The long-term solution is to move to fast, high-level languages. I think Julia and LuaJIT are the
by jakobnissen 4y ago
What you're describing is known as the "two language problem". The long-term solution is to move to fast, high-level languages. I think Julia and LuaJIT are the only examples currently, but surely more will crop up. This is s fundamental problem that will not go away on its own.
Efforts like Numba can alleviate some of the pain of a slow Python, but it turns out it's generally not possible to retroactively fit a JIT compiler onto a language designed not designed to be compiled.
In my experience, once I tried moving my work code to Julia, it became clear to me just how much energy I had spent trying to overcome the performance wall of Python, and I can't imagine going back now.
- v3ss0n 4y agoPython have PyPy and it's underrated. Imagine 7-20x performance boost without changing a line of code.
- jakobnissen 4y agoIIUC, the performance of PyPy is still quite far behind normal compiled languages, due to limitations inherent in Python. And then it has limitations in its interop with Numpy and C libraries, at least last I checked. That's the general picture when trying to overcome Python's performance wall: Sometimes you can use Cython, or Numba, or PyPy or Numpy vectorization, or call into C. But only sometimes, and they each come with their own set of awful restrictions and caveats. It's such a breath of fresh air to switch to a fast language and just forget all those hacks and workarounds. I get why people just migrate to static languages
- zem 4y agosecond time this week i've had occasion to mention lush[1], which was in many ways an early attempt at what julia is doing now. from their homepage: 8<-------------------------------------------- Lush brings the best of both worlds by wrapping three languages into one: (1) a weakly-typed, garbage-collected, dynamically scoped, interpreted language with a simple Lisp-like syntax, (2) a strongly-typed, lexically-scoped compiled language that uses the same Lisp-like syntax, and (3) the C language, which can be freely mixed with Lush code within a single program, even within a single function. It sounds complicated, but it is not. In fact, Lush is designed to be very simple to learn and easy to use. 8<-------------------------------------------- [1] http://lush.sourceforge.net/ http://lush.sourceforge.net/