3 ms·
JavaScriptCore uses this technique for JavaScript arrays that are used as deques, like if you unshift/shift. Here's the core data structure: https://github.com
by pizlonator 2y ago
JavaScriptCore uses this technique for JavaScript arrays that are used as deques, like if you unshift/shift.
Here's the core data structure: https://github.com/WebKit/WebKit/blob/main/Source/JavaScriptCore/runtime/ArrayStorage.h https://github.com/WebKit/WebKit/blob/main/Source/JavaScript...
The logic that makes it work is in JSArray.cpp and other files in that directory.
Shift-to-middle is surprisingly performant and also surprisingly hard to get right.