Well.

I think that is sort of the wrong question, what do you really want?

But:

As long as you have a multiset (and, in 8.0+ probably mapping) and do
not change it's content the iteration order tends to be stable (modulo
gc of destructed things in said containers in this case, or if they
have weak marked values/indices as applicable, although I guess that
could count as modifying them).

Mulisets are tree-order, but for some things it's pointer-address, for
some it's `< on the value (aka, int and float). You can also write a
`< operatoror that returns random(2) for great justice when comparing
objects..

When you insert new things the order will of course change, since a
new thing is there (same goes for removing items).

So, more or less: Multisets are stable, unless modified, as long as
the process is running. If it's a multiset of ints (or possibly
floats) the order is always the same, for all pikes.


Mappings are a hashtable, and the iteration is done in
hash-table-bucket-order. As such, whenever they are modified things
can move around.

It used to be that just indexing the mapping changed the order (the
found item was moved to the top of the hash chain of it's bucket), I
am not sure what the current status of that performance killing
abomination is. :)
  • random on iterator... Martin Nilsson (Coppermist) @ Pike (-) developers forum
    • random on ite... Per Hedbor () @ Pike (-) developers forum
      • random on... Per Hedbor () @ Pike (-) developers forum
      • random on... Martin Nilsson (Coppermist) @ Pike (-) developers forum
        • rando... Per Hedbor () @ Pike (-) developers forum

Reply via email to