jargon

Comparison

Deep equalityvsStructured clone

Deep equality

you compared the two API responses field by field, all the way down, to decide whether to update.

Recursively comparing every nested value to decide whether two structures are equivalent. It gives the answer people intuitively want, at a cost proportional to the size of the data — and on a hot path that comparison can exceed the render it was meant to avoid. Cycles, dates, maps and undefined-versus-missing keys all make correct implementations subtler than they look.

Full entry →

Structured clone

you posted the object to a worker and got a real deep copy on the other side, but the functions were gone.

The browser's own deep-copy algorithm, used when passing data to workers, into IndexedDB, or through `structuredClone()`. It handles cycles, dates, maps, sets and typed arrays, which JSON round-tripping does not. It throws on functions, DOM nodes and class instances, which is why an innocuous `postMessage` can fail on an object that looked like plain data.

Full entry →

Related comparisons