2 ms·
> D, which uses GC here and there and a lot of non-GC pointers and allocations Won't this depend on the programming style used? If the programmer makes heavy u
by MaxBarraclough 6y ago
> D, which uses GC here and there and a lot of non-GC pointers and allocations
Won't this depend on the programming style used? If the programmer makes heavy use of functional programming, or for that matter Java-style programming, wouldn't that result in a lot of object churn through the GC?
- mhh__ 6y agoFunctional code as usually written in D doesn't have this problem because people are aware of this - most compositions are extremely lazy, allocations are trivial to group together because of allocators in the stdlib
- WalterBright 6y agoJava does not have stack allocated objects like struct instances. They get allocated via the GC (sometimes the Java optimizer can optimize these to be stack allocated). Personally, I make very heavy use of stack allocated objects, even for temporary buffers. Stack allocated objects cost nothing to allocate, nothing to free, and (being on the stack) are already in the hot memory cache.