News for hackers. Stuff that matters.
Re:Moving from Ruby to Rust by outworlder on Thursday February 14, 2019 @06:31PM (#19167102)
There are no 'fast languages'. Just fast implementations.

This distinction is important.

Re:Moving from Ruby to Rust by marcosdumay on Thursday February 14, 2019 @06:46PM (#19167194)
You won't get anything near the performance of a usual Rust code by optimizing some CPython code. It doesn't matter how much you try.
Re:Moving from Ruby to Rust by jhayward on Thursday February 14, 2019 @09:58PM (#19168126)
CPython being an implementation of the Python encironment.
Re:Moving from Ruby to Rust by icebraining on Thursday February 14, 2019 @09:44PM (#19168064)
Who said anything about CPython? Pypy can get close to C speed, so I doubt it can't get anywhere near Rust.
Re:Moving from Ruby to Rust by dagw on Friday February 15, 2019 @07:43AM (#19170395)
PyPy will get you a 10-time speed up over pure Python in real-world code on a good day. While that is nice, it's not close to C.
Re:Moving from Ruby to Rust by marcosdumay on Friday February 15, 2019 @06:13AM (#19169967)
Well, Pypy doesn't allow the same language as CPython.

It has a lot of similarity, but it's not the same.

Re:Moving from Ruby to Rust by goatlover on Thursday February 14, 2019 @06:46PM (#19167196)
Yeah, but some languages are designed with performance in mind and others are not. So while people have made faster implementations of JS, Python, Ruby, etc over time, they're at a disadvantage compared to languages like C/C++, Fortran and Rust. You can't really compete with a good compiler for those languages, which is why WebAssembly, Julia and Crystal exist.
Re:Moving from Ruby to Rust by gchamonlive on Thursday February 14, 2019 @07:11PM (#19167351)
I can't seem to find references for it right now, but there are severe advantages statically typed languages have over dynamically typed in terms of performance and weakly typed over strongly typed in terms of safety. The stronger the type system in a language, the greater the array of type level optimizations the compiler can do.

There is simply no way of knowing enough to optimize when compiling a python script comparing to rust for example.

Language depth has a cost though in terms of raw productivity, that is why there are languages like matlab that are there simply for prototyping and nobody in their right mind would use it for production purposes

Re:Moving from Ruby to Rust by jashmatthews on Thursday February 14, 2019 @07:33PM (#19167509)
> There is simply no way of knowing enough to optimize when compiling a python script comparing to rust for example.

JIT with type specialization can do exactly that. It's all about whether the runtime cost is worth it.

Re:Moving from Ruby to Rust by gchamonlive on Thursday February 14, 2019 @08:39PM (#19167822)
Comparable to rust in terms of type level optimization? I am extremely curious about this and I want to know more, can you provide me with references?
Re:Moving from Ruby to Rust by jashmatthews on Friday February 15, 2019 @04:55AM (#19169689)
The JS JIT in WebKit used to use the same LLVM backend as Rust: https://webkit.org/blog/3362/introducing-the-webkit-ftl-jit/

This is one of the classic papers on type specialization in JIT: http://www.cs.williams.edu/~freund/cs434/gal-trace.pdf

Re:Moving from Ruby to Rust by gchamonlive on Friday February 15, 2019 @07:02AM (#19170177)
That is really cool thanks! I'm going to start reading
Re:Moving from Ruby to Rust by recursive on Thursday February 14, 2019 @07:07PM (#19167327)
There are languages which don't permit fast implementations. You might consider a "fast language" to be one for which it's possible to write a fast implementation.
Re:Moving from Ruby to Rust by firethief on Sunday February 17, 2019 @01:18AM (#19182939)
Now you have me thinking about whether it would be possible to design a non-fast language--that is, a language resistant even to tracing JIT. Programs in this language would have to defy the usual pattern of having hot loops that can be compiled once and run repeatedly. That seems to imply that operators must change behavior as they're repeated. In the typical machine model that's only suitable for a toy language, but it might make sense for a language the somehow compiles to neural net logic...