[dev] [cvs] commit: framework/DataTree DataTree.php

Michael M Slusarz slusarz at horde.org
Thu Jan 4 00:05:39 PST 2007


Quoting Michael M Slusarz <slusarz at horde.org>:

> slusarz     2007-01-04 00:03:27 PST
>
>   Modified files:
>     DataTree             DataTree.php
>   Log:
>   phpdoc, style nits, use pre-decrement, no refs when calling 'new'.
>   Most important, use array_search() instead of array_flip().  Uses half the
>   memory.
>
>   Revision  Changes    Path
>   1.178     +148 -119  framework/DataTree/DataTree.php

For future reference, here was my benchmark tests.

<?php
$a = range(0, 100000);
array_search(100000, $a);
print memory_get_peak_usage();
?>

Output: 7885148

<?php
$a = range(0, 100000);
$b = array_flip($a);
$c = $b[100000];
print memory_get_peak_usage();
?>

Output: 15734068

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list