roxen.lists.pike.general

Subject Author Date
RE: Arrays, multisets, mappings: avoiding unnecessary memory (re)assigns Arjan van Staalduijnen <Arjan[dot]van[dot]Staalduijnen[at]rtl[dot]nl> 08-09-2009
Hopefully properly answering one of my own questions:

> In this case I was using the multiset as a 'single entry per index only', so
> the ids[ identifier ] = 1/0 should work just fine for me. Instead of a multiset
> which sets a specific index to 1 or 0, I could use a mapping and the same
construction,
> using m_delete instead of the setting to 0. Would there be a difference in
impact?

Multiset would be faster, because it would only have to do a single memory
dereference for the index, instead of two for a mapping; one for the index, one
for the value. If there'd be more differences, I'd still be happy to learn about
them. :-)


AvS