<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 10, 2017 at 10:31 AM, Chandler Carruth via Phabricator via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">chandlerc added a comment.<br>
<br>
Have you considered building a `ChunkedVector` instead of a `ChunkedList`? Specifically, there is a great trick where you use a single index with the low bits being an index into the chunk and the high bits being an index into a vector of pointers. It has many of the benefits you list and is a bit simpler I think. It also supports essentially the entire vector API if desired. Both bi-directional and even random access are reasonably efficient. Good locality, etc.<br>
<br>
The only downside I can see is that is is possible to implement insertion into the middle of `ChunkedList` with bounded complexity, but with `ChunkedVector` it would still be linear. However, you don't seem to have implemented arbitrary insertion and so I'm hoping that isn't necessary.<br></blockquote><div><br></div><div>If you really need it, you can play gap-buffer like games so that you can make it relatively sane for most patterns.</div><div><br></div></div></div></div>