4 ms·
There's lots of interesting optimizations enabled by immutable data. E.g. in generational collectors old data can never point at new data, which can be used to
by dons 13y ago
There's lots of interesting optimizations enabled by immutable data. E.g. in generational collectors old data can never point at new data, which can be used to gain additional performance.
see e.g. http://research.microsoft.com/en-us/um/people/simonpj/papers/parallel/local-gc.pdf http://research.microsoft.com/en-us/um/people/simonpj/papers...
- chowells 13y agoThough the GHC runtime isn't an example of immutable data. Haskell code actually results in a lot of mutation behind the scenes. It's quite possible for older generations to point to data in newer generations in Haskell. It's even likely with some use patterns. Given that you already know this, I assume you must be talking about strict functional languages specifically.
- ezyang 13y agoAre you referring to thunk update after lazy evaluation? This is a very special kind of mutation, because after the update, it is guaranteed never to be mutated again. This is quite helpful for generational GC, actually, and underlies the concept of "eager promotion".