Hacker News new | ask | show | jobs
by scottlamb 1802 days ago
I agree GC doesn't necessarily mean more CPU. Just more RAM. My reason for thinking Rust code generally uses less CPU is based on it using a more sophisticated compiler.

That said, when Rust code spends a lot of time on allocations, it's usually fixable:

* You can switch global allocators to jemalloc or, for short-lived programs with acceptable total allocation size, bumpalo.

* You can often restructure code to borrow/reuse buffers instead of having per-iteration allocations.

* You can use slabs or arena allocators.