hughfdjackson / immutable

neatly packages immutable equivalents to JavaScript's Objects and Arrays.
101 stars 7 forks source link

Implement structural sharing #4

Closed hughfdjackson closed 11 years ago

hughfdjackson commented 11 years ago

At the moment, any write operation does a fully shallow copy, which is O(n) write, and also a full duplication of the original in terms of memory.

Clojure has shown us that, with sneaky data-sharing and a lovely GC, we can get this down to O(log n). The implementation for string-only shouldn't be too hard. Git 'er done.