Basic Framework Data Structures
Posted: Thu Nov 16, 2006 9:12 am
Okies. First, hello!
*New here, though not to php per se*
Now. I'm rolling my own OO framework (isn't almost everyone?)
and, as a part of that process, I started along the path of establishing basic data structures such as linked lists et al.
Now, the problem I see with this (and I've seen many others do it - even Pear are/have) is that arrays ARE basically double linked lists - and they operate at a compile level, so are generally faster.
ASfter much benchmarking, the only place I've seen a linked list class faster, is where new nodes/entries are placed at the head of the list (or unshifted into an array version).
For all all other uses, an array is quicker. So. Instead of creating a linked list class (single or double) in the traditional manner - it seems a better approach is to do it using an array within the class.
Unless you are moving material to the head. Even a stack can be simulated better with an array.
Is there something I'm not seeing here? ANyone else have similar experiences?

Now. I'm rolling my own OO framework (isn't almost everyone?)
Now, the problem I see with this (and I've seen many others do it - even Pear are/have) is that arrays ARE basically double linked lists - and they operate at a compile level, so are generally faster.
ASfter much benchmarking, the only place I've seen a linked list class faster, is where new nodes/entries are placed at the head of the list (or unshifted into an array version).
For all all other uses, an array is quicker. So. Instead of creating a linked list class (single or double) in the traditional manner - it seems a better approach is to do it using an array within the class.
Unless you are moving material to the head. Even a stack can be simulated better with an array.
Is there something I'm not seeing here? ANyone else have similar experiences?