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.