News for hackers. Stuff that matters.
Re:A Deep Introduction to JIT Compilers: JITs are not very J... by jashmatthews on Monday July 06, 2020 @01:21AM (#23744954)
What you're really seeing the benefit of here isn't manual memory allocation but stack allocation. Hammering malloc/free in Rust is slower than using even a pretty simple GC which is why there are crates to do arena based allocation.

As a more concrete example splitting strings by copying in Rust and hammering malloc and memcpy is 4-5x slower than using slices in Go and letting the GC deal with keeping things alive.

You might say that's not a fair comparison but few businesses can tolerate the messing around that is writing zero copy Rust.

malloc implementations actually do optimize by delaying the work of free(1). They do a lot of complex stuff hidden behind those function calls to improve performance.

There are no comments on this comment yet.