On Tue, May 5, 2009 at 4:17 AM, Casey Duncan
<casey@xxxxxxxxxxx> wrote:
Just to clarify my position, performance is a secondary concern, primarily I'm concerned about intuitiveness and convenience. I suspect an immutable vector type will cause a regular amount of mail traffic asking how to mutate them and why that is not possible. I could be wrong, but I think many folks will be surprised by an immutable vector class.
I'm +0 on immutable vectors, they're certainly much better than nothing, but I personally would prefer mutable.
To make immutable types more performant, you should look at the implementation of tuples in Python. tuple instances are pooled so they can be recycled, saving a lot of memory management overhead. I did a similar thing for vectors in Lepton with good results.
-Casey
+1 for memory pools. Memory is the main overhead for performance these days. Anything to avoid a copy or a malloc/mmap, and to group areas of memory together for reading.
Mutable vectors fail the use cases: