News for hackers. Stuff that matters.
Re:Show HN: Array with Constant Time Access and Fast Inserti... by asdfasgasdgasdg on Tuesday September 03, 2019 @09:18PM (#20873098)
This is very similar to what std::deque does under the covers already. It's a chunked array. The main difference AFAICT from std::deque is that this offers n^1/2 insertion and deletion within the body of the array. This guarantee is provided by allowing for the possibility of significant overallocation in the chunks themselves, if many modifications happen in the middle of the array. On the other hand, std::deque does not overallocate by as much -- just a chunk at the beginning and a chunk at the end. But as a consequence it has to move trailing elements when an element is inserted or deleted in the middle.

Interesting!

Re:Show HN: Array with Constant Time Access and Fast Inserti... by igushev on Tuesday September 03, 2019 @09:25PM (#20873126)
DEQs also allocate internal arrays with hardcoded size only (8 in std, if I remember correctly)
Re:Show HN: Array with Constant Time Access and Fast Inserti... by asdfasgasdgasdg on Tuesday September 03, 2019 @10:34PM (#20873469)
At least in libc++ it's the greater of 4kB or 16 * sizeof(value_type). That's the default, it is configurable. 8 would be a pretty unfortunate design choice.
Re:Show HN: Array with Constant Time Access and Fast Inserti... by temac on Wednesday September 04, 2019 @08:15AM (#20876374)
Can you also benchmark against std::deque?