News for hackers. Stuff that matters.
Re:Fixing Python Performance with Rust by jlarocco on Wednesday October 19, 2016 @08:51PM (#12749090)
A neat case study, but "Embedding Rust in Python" is a poor way to phrase it.

If I'm reading it correctly they're just using CFFI to load and call a shared library - it's really not embedding anything. The fact that the library was written in Rust is interesting, but as far as Python is concerned it could easily have been written in any language that can create a shared library.

Re:Fixing Python Performance with Rust by the_mitsuhiko on Thursday October 20, 2016 @04:23AM (#12750557)
> If I'm reading it correctly they're just using CFFI to load and call a shared library - it's really not embedding anything. The fact that the library was written in Rust is interesting, but as far as Python is concerned it could easily have been written in any language that can create a shared library.

Of which there are not that many that would make a shared library that can be safely loaded into a Python process. Traditionally this was limited to C and C++. As far as embedding goes: Rust like most things needs minimal runtime support and that is embedded in the dylib.

Re:Fixing Python Performance with Rust by jlarocco on Thursday October 20, 2016 @12:26PM (#12753756)
FWIW, most languages that can generate native code can generate shared libraries, and will usually have instructions for how to call the libraries from other languages.

Here's how to do it Haskell, for example: https://downloads.haskell.org/~ghc/7.6.3/docs/html/users_gui...

That said, if optimization gets to the point where re-writing in a different language is a good idea, most people just jump to C or C++, or in this case Rust, because they're the fastest.

Re:Fixing Python Performance with Rust by byronyi on Wednesday October 19, 2016 @09:51PM (#12749318)
Indeed. A more interesting comparison would be between C/C++ based shared library and Rust based one.
Re:Fixing Python Performance with Rust by lqdc13 on Thursday October 20, 2016 @12:18AM (#12749705)
Or how about Rust-FFI, C-FFI, C-API directly, Nim-to-C-API (pymod), Julia python module, ctypes, cython, libboost, and swig for a good measure.

There are examples of each of these compared to one or the other but it would be nice to see all of them compared in a few benchmarks.

Re:Fixing Python Performance with Rust by monkeyshelli on Thursday October 20, 2016 @01:19AM (#12749891)
One benchmark to rule-them-all would sound awesome!