3 ms·
There's no diff. Arrays get proxies just like everything else. For mutations that change the length, extra elements are built or removed at the end. Assignme
by recursive 3y ago
There's no diff. Arrays get proxies just like everything else.
For mutations that change the length, extra elements are built or removed at the end. Assignment straight to an index (that doesn't change length) is able to use normal object property semantics.
arr.push(e) and arr[i] = e are both O(1). But not all array operations achieve this.
- notnullorvoid 3y agoWow, took a look at the ForEach code to better understand. That's a very novel approach.
- recursive 3y agoI'm not too familiar with the state of the art, but I assumed this had been done before. I have some vague ideas about implementing efficient .splice() calls. Right now knowledge about splicing semantics is lost in between the proxy layer and `ForEach` DOM node array. But I have a bunch of other plans to do first.