Re: Tree sort in C
| From: | Maurice Makaay | Date: | Wed, 09 May 2007 17:20:25 +0000 |
| Subject: | Re: Tree sort in C | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29378@lists.php.net to get a copy of this message | ||
Hi,
A quick sketch of an idea that should work: Yes, that would work. The problem though, is that there's still accumulation of data going on, before the actual sorting can take place. Remember that the main reason for writing the C-extension was to get the memory usage down.Here's some benchmarks that I just did between the multisort solution and the extension (time / memory). I commented out the efree() calls in the extension so see the actual memory usage in these benchmarks: 10 nodes extension 4.19616699219E-05 / 756 multisort 0.000128984451294 / 3916 100 nodes extension 0.000138998031616 / 5444 multisort 0.000992059707642 / 32536 1000 nodes extension 0.00320601463318 / 52276 multisort 0.0115978717804 / 320988 5000 nodes extension 0.127704143524 / 260356 multisort 0.0901730060577 / 1594448 10000 nodes extension 0.438856840134 / 520308 multisort 0.172026872635 / 3196832 As you can see, the extension is faster and lighter on memory. At a really large number of nodes, the extension becomes slower, but the memory stays low. It's the memory that bothers my servers the most, not the execution time. With kind regards, Maurice Makaay Phorum.org