point ! I'll try to refactor my code to include maps.

However, as mentionned above, I will have most probably to include JAVA librairies into my modules (maths), and might loose overall Immutability through these as well.

Thx everybody for the very helpful advises.

Cheers

Jean-Marc



2013/11/12 Charles Duffy <charles@dyfis.net>
On Tue, Nov 12, 2013 at 3:05 PM, jean-marc Mercier <jeanmarc.mercier@gmail.com> wrote:
Thus I could use maps to simulate HashSet, it not a very big overload. 
However, is there any incentive to trade off 20% performance ?

Immutability is its own reward, or, rather, comes with its own set of them. :)

Working with immutable data makes lock-free thread-safety comparatively trivial, and enables a wide array of aggressive optimizations (including providing the compiler the option to make operations concurrent at-will; safe caching/memoization; etc).

Moreover, introducing things that *aren't* known to be immutible, thread-safe, deterministic operations into an environment where those guarantees otherwise exist means that a lot of optimizations are suddenly off-the-table / unsafe.