[squeak-dev] How immutable data structures can _increase_ application performance

Frank Shearar frank.shearar at gmail.com
Mon Dec 23 08:19:10 UTC 2013


On 23 December 2013 00:43, Levente Uzonyi <leves at elte.hu> wrote:
> On Sun, 22 Dec 2013, Frank Shearar wrote:
>
>> http://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/
>>
>> In which David Nolen shows how |UIs built with persistent data
>> structures outperform those using mutable state, simply because you
>> can check for changes with a simple reference equality check. And you
>> get undo for free, and snapshots are trivial. And, because decent
>> persistent data structures share structure, it's memory efficient.
>
>
> According to my benchmarks (and my memory) the immutable binary trees (and
> other non-binary tree structures) I've built were all about 6x slower than
> mutable ones. Spur might make a difference, because the extra cost comes
> mostly from GC. But currently a mutable tree with a semaphore is way faster.

In the article David calls out the fact that (a) persistent data
structures often are slower than mutable structure partly because (b)
they produce more garbage but that (c) _despite that_, the things that
use them can be way faster. Given a huge tree of objects (like the
DOM) you can check for changes by walking the tree with an extremely
fast reference check, instead of having to walk the properties of the
objects in the tree.

frank

> Levente
>
>>
>> frank
>>
>>
>


More information about the Squeak-dev mailing list