Re:A Personal Lisp Crisis (2012)
by lucian1900 on Wednesday September 11, 2013 @12:11PM
(#6368058)
That technique (commonly called semispace GC) works for mutable data as well, as long as you have a pointer indirection (so you can move), it's just less efficient than most others. It would be interesting to see whether the balance would shift significantly with immutable objects.
Re:A Personal Lisp Crisis (2012)
by cynicalkane on Wednesday September 11, 2013 @12:06PM
(#6368026)
This is a common practice in GC. For example, the JVM already does this by default, and you don't need to give it immutable data.
Re:A Personal Lisp Crisis (2012)
by reitzensteinm on Wednesday September 11, 2013 @12:24PM
(#6368138)
But immutability makes it conceptually a hell of lot cleaner, and feasible to do even if you're investing orders of magnitude less in your GC than went into the JVM.
Which is important if Clojure gets ported to bare metal runtimes, as the parent was suggesting.
In certain circumstances - for instance a web framework creating a heap for each request - this will make GC dramatically cheaper. Though of course your cache locality will be poor.