[vlc-devel] [RFC 0/3] Improving vlc_array_t
rom1v at videolabs.io
Sun Jul 22 21:46:32 CEST 2018
On Sun, Jul 22, 2018 at 03:29:32PM +0300, Rémi Denis-Courmont wrote:
> Le samedi 21 juillet 2018, 23:01:25 EEST Romain Vimont a écrit :
> > > > > But TBH, it is quite seldom that we do index-based random access.
> > > > > Usually,
> > > > > it's either sequential access or look-up by some key.
> > Random access is sometimes needed though. For example, for random
> > playing, selecting the next item involves swapping two items by index
> > (e.g. Fisher–Yates algorithm).
> I would argue that fast insertion and fast deletion of item is more important
> than fast shuffled iteration. So that makes an array a terrible choice. And we
> need to support insertion/deletion by index, as well as by sorting criterion.
Anyway, the model in the UI will need to access the playlist items from
their indices (e.g. QAbstractListModel in Qt), so at some point random
access is necessary.
More information about the vlc-devel