Basic Framework Data Structures

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
evilkate
Forum Newbie
Posts: 1
Joined: Thu Nov 16, 2006 8:43 am

Basic Framework Data Structures

Post by evilkate »

Okies. First, hello! :P *New here, though not to php per se*

Now. I'm rolling my own OO framework (isn't almost everyone?) :P 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?

:)
Post Reply