JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.js"></script>
<p>
Open up dev tools and go the to memory tab. Watch the memory usage of this tab. Then
</p>
<button id="makeArray" onclick="makeArray()">
make array
</button>
<button id="makeImmutable" onclick="makeImmutable()" disabled="disabled">
make immutable
</button>
<p>
To try again, close this tab and open it again to flush any cache
</p>
JavaScript
var a = [];
var b = Immutable.List();
function makeArray() {
for (var i = 0; i < 1000000; i++) {
a.push({
id: i,
name: 'name' + i,
});
}
document.getElementById('makeImmutable').disabled = false;
}
function makeImmutable() {
for (var i = 0; i < 1000000; i++) {
b = b.push(Immutable.Map({
id: i,
name: 'name' + i,
}));
}
}