unread
"Marcus Boerger" helly@php.net wrote in message
news:154582775.20081103164129@marcus-boerger.de...
Hello Ionut,
some remarks about your proposal:
- You can turn any array into a Traversable using
(Recursive)ArrayIterator. Though this solution is still slow. The issue is
that the c-level code needs to verify the current pointer every single
time
it uses it and that means traversing the array from the beginning. That
said we might want to:
a) Optimize that for cases where we don't have to. Basically when nothing
else is pointing to the array (refcount==1) we know when the array can be
changed and do not have to verify it always.
b) provide a lower level array to traversable mechanism that operates on
the current pointer provided by the array itself. That way having no need
to verify that pointer at all.
That would be nice.
Just written some code todo a binary search on keys, using the
ArrayIterator::seek().
It was either that or use array_keys()
on potentially large array.
Jared