3 ms·
> Manual memory management being faster than GC is a function of controlling memory layout Control over memory layout and manually allocating and freeing memor
by MrBuddyCasino 3y ago
> Manual memory management being faster than GC is a function of controlling memory layout
Control over memory layout and manually allocating and freeing memory are orthogonal issues.
I can optimize memory layout in Java too by using primitive data types instead of pointer-chasing objects, or structs of arrays vs array of structs type of things in order to improve access patterns. I can't control alignment and padding, except indirectly, thats true, but that is not what people mean when they say "manual memory management". Rust gives you control over memory layout, but has "automatic" memory management.
> forcing you to be a bit smarter about how you do things, to be less wasteful
Yes this is what I meant.