3 ms·
Exactly. In .NET heap allocations are practically as fast as stack allocations, although of course there are other things you need to be aware of when using a c
by sratner 18y ago
Exactly. In .NET heap allocations are practically as fast as stack allocations, although of course there are other things you need to be aware of when using a compacting generational GC, such as avoiding medium-lived objects at all costs. .NET does also provide value-types that can be allocated on the stack, and you use them for reasons that are better than "heap allocations are slow".
I think the moral of the story is: to get the maximum performance out of your memory management system, you need to know how it works. This applies equally well to C++.