On 09/05/07, Brian Moon <[EMAIL PROTECTED]> wrote:
Derick Rethans wrote:
> On Wed, 9 May 2007, Maurice Makaay wrote:
>
>> At a really
>> large number of nodes, the extension becomes slower, but the memory stays 
low.
>
> That is very peculiar... it should never be slower than an
> implementation in PHP - unless your algorithm isn't optimal.

Me too.  But, fwiw, the multisort method does not do the same thing.
So, its apples to oranges.  See my other email.  In the apples to apples
comparisons with use the same algorithm in PHP and in C, the C version
is always faster.


I agree with Brian here, the code I referenced was an array multisort
by column which I created based upon user notes on the array_multisort
function. You do not require a trawl through to get the list of "keys"
like is done here.

So,

$sorted = array_multisort_column($nodes, 'parent_id', 'id');

It is a single pass mechanism. It uses the indexes supplied to compare
them in sequence. A simple bubble sort.

BUT this is not a tree sort as this is something quite different. The
array_multisort() nor my array_multisort_column() functions will not
work for more than 1 level of parent/child relationships.

Richard


--

Brian Moon
Senior Developer
------------------------------
http://dealnews.com/
It's good to be cheap =)



--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to