3 ms·
Not so sure about that. JITs can be fast, faster than C or Rust in some circumstances. Besides, the code was a trainwreck.
by c7DJTLrn 5y ago
Not so sure about that. JITs can be fast, faster than C or Rust in some circumstances. Besides, the code was a trainwreck.
- axiosgunnar 5y ago> faster than C or Rust in some circumstances how?
- jph 5y agoDynamic optimizations for the specific target machine and also long lifetimes. For example when a specific target machine has a specific CPU instruction that the JIT can leverage, or has a ton of RAM that the JIT can use for caching such as for memoized methods.
- olau 5y agoI remember asking the same question about Java many years ago. Some optimizations become much easier in the actual running environment. You know the hardware so don't have to cater to lowest common denominator, and you know what's actually happening and don't have to guess. Profile-guided optimizations later showed up to bridge some of the gap, but I think JITs are typically built with a different mind set, so there are some things they excel at. A funny example is something like a regexp matcher where a JIT might take an actual regexp built on the fly, say based on a user searching for "foo bar", and optimize code for it.
- lillecarl 5y agoShow me any real benchmarks where actual python is faster or just as fast as C or Rust please. The python GIL shines with it's presence, it will not be as fast in any real workload and we're usually fine with that because speed doesn't usually matter that much when we're waiting on I/O all the time anyways.
- feanaro 5y agoThe code was a trainwreck because it was written with the aim of getting it done in a handful of hours and without using a properly designed Matrix crate. For a real world use case, you'd just use matrix-rust-sdk.
- fnord77 5y agofor some JITs. Java's vm approaches or exceeds C in terms of speed. Unless something has changed, Python's runtime is very slow compared to just about everything else.