JavaScript and Immutability — How fast is fast enough?
Miguel Ventura
673

This is true that ImmutableJS is not worthy for small records.

However you don’t need a lib at all to mutate small records like you did.

Please take 2 minutes to view this video:

You can see you can easily mutate existing objects in an immutable way with Object.assign, or even more easily with new rest/spread syntax. It requires additional tooling but in my experience it’s definitively worth doing so!

Persistent data structures are mostly useful for big lists and not worthy for small items. This is also because they generally use 32 blocks so obviously if you have less than 32 attributes/objects you are just using a slower record/array without any additional benefits.

See also my experiments trying to render huge immutableJs lists with React and how they can leverage better performances:

http://stackoverflow.com/questions/30976722/react-performance-rendering-big-list-with-purerendermixin