Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // $tree = generateData(10, 4, null);
- // insertTreeFHRecursive($tree);
- // insertTreeMPRecursive($tree);
- $ids = array();
- for ($i = 20; $i--;) {
- $ids[] = mt_rand(1, 111110);
- }
- $start = microtime(1);
- foreach ($ids as $id) {
- /*
- * 0.018718957901001
- * 0.014946937561035
- * 0.018213987350464
- * 0.018930912017822
- */ getTreeByParent_FH ($id);
- }
- echo microtime(1) - $start , "\n";
- $start = microtime(1);
- foreach ($ids as $id) {
- /*
- * 0.99656295776367
- * 1.1232969760895
- * 1.3415250778198
- * 1.090959072113
- */ getTreeByParent_MP ($id);
- }
- echo microtime(1) - $start , "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement