3 ms·
It's then interesting to compare to C#, which also can do stack allocation, but still chooses a generational GC.
by staticassertion 8y ago
It's then interesting to compare to C#, which also can do stack allocation, but still chooses a generational GC.
- kjeetgill 8y agoI knew it had it but I have no C# experience. Does idiomatic code use this or only more niche optimizations?
- pjmlp 8y agoAll performance critical data structures are value types. Meaning int, long, char, bool, ..., points, rectangles, pairs, colours, enumerations. Then generics are reiffed. So each instance gets a copy if value types are used. Additionally, you can explicitly allocate value types and arrays on the stack and there are APIs for manual memory management.
- masklinn 8y agoC# defaults to reference types, structs are not usually recommended as the default way to build your own types, only as an optimisation.