@@ -14,15 +14,15 @@ discard block |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeMap; |
| 20 | 20 | use chdemko\SortedCollection\ReversedMap; |
| 21 | 21 | |
| 22 | 22 | date_default_timezone_set('UTC'); |
| 23 | -printf('ReversedMap benchmarking run on ' . date('r') . PHP_EOL . PHP_EOL); |
|
| 24 | -printf('%25s %10s %10s %10s' . PHP_EOL, 'Operation', 'n', 'seconds', 'μs/(n log(n))'); |
|
| 25 | -printf('-------------------------------------------------------------' . PHP_EOL); |
|
| 23 | +printf('ReversedMap benchmarking run on '.date('r').PHP_EOL.PHP_EOL); |
|
| 24 | +printf('%25s %10s %10s %10s'.PHP_EOL, 'Operation', 'n', 'seconds', 'μs/(n log(n))'); |
|
| 25 | +printf('-------------------------------------------------------------'.PHP_EOL); |
|
| 26 | 26 | |
| 27 | 27 | $tree = TreeMap::create(); |
| 28 | 28 | $reversed = ReversedMap::create($tree); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $end = microtime(true); |
| 45 | 45 | |
| 46 | 46 | printf( |
| 47 | - '%25s %10d %10.2f %10.2f' . PHP_EOL, |
|
| 47 | + '%25s %10d %10.2f %10.2f'.PHP_EOL, |
|
| 48 | 48 | 'Search all elements', |
| 49 | 49 | $count, |
| 50 | 50 | $end - $start, |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $end = microtime(true); |
| 71 | 71 | |
| 72 | 72 | printf( |
| 73 | - '%25s %10d %10.2f %10.2f' . PHP_EOL, |
|
| 73 | + '%25s %10d %10.2f %10.2f'.PHP_EOL, |
|
| 74 | 74 | 'Loop on all elements', |
| 75 | 75 | $count, |
| 76 | 76 | $end - $start, |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $end = microtime(true); |
| 95 | 95 | |
| 96 | 96 | printf( |
| 97 | - '%25s %10d %10.2f %10.2f' . PHP_EOL, |
|
| 97 | + '%25s %10d %10.2f %10.2f'.PHP_EOL, |
|
| 98 | 98 | 'Count all elements', |
| 99 | 99 | $count, |
| 100 | 100 | $end - $start, |
@@ -14,15 +14,15 @@ discard block |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeMap; |
| 20 | 20 | use chdemko\SortedCollection\SubMap; |
| 21 | 21 | |
| 22 | 22 | date_default_timezone_set('UTC'); |
| 23 | -printf('SubMap benchmarking run on ' . date('r') . PHP_EOL . PHP_EOL); |
|
| 24 | -printf('%25s %10s %10s %10s' . PHP_EOL, 'Operation', 'n', 'seconds', 'μs/(n log(n))'); |
|
| 25 | -printf('-------------------------------------------------------------' . PHP_EOL); |
|
| 23 | +printf('SubMap benchmarking run on '.date('r').PHP_EOL.PHP_EOL); |
|
| 24 | +printf('%25s %10s %10s %10s'.PHP_EOL, 'Operation', 'n', 'seconds', 'μs/(n log(n))'); |
|
| 25 | +printf('-------------------------------------------------------------'.PHP_EOL); |
|
| 26 | 26 | |
| 27 | 27 | $tree = TreeMap::create(); |
| 28 | 28 | $sub = SubMap::create($tree, null, null); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $end = microtime(true); |
| 49 | 49 | |
| 50 | 50 | printf( |
| 51 | - '%25s %10d %10.2f %10.2f' . PHP_EOL, |
|
| 51 | + '%25s %10d %10.2f %10.2f'.PHP_EOL, |
|
| 52 | 52 | 'Search all elements', |
| 53 | 53 | $count / 2, |
| 54 | 54 | $end - $start, |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $end = microtime(true); |
| 79 | 79 | |
| 80 | 80 | printf( |
| 81 | - '%25s %10d %10.2f %10.2f' . PHP_EOL, |
|
| 81 | + '%25s %10d %10.2f %10.2f'.PHP_EOL, |
|
| 82 | 82 | 'Loop on all elements', |
| 83 | 83 | $count / 2, |
| 84 | 84 | $end - $start, |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $end = microtime(true); |
| 107 | 107 | |
| 108 | 108 | printf( |
| 109 | - '%25s %10d %10.2f %10.2f' . PHP_EOL, |
|
| 109 | + '%25s %10d %10.2f %10.2f'.PHP_EOL, |
|
| 110 | 110 | 'Count all elements', |
| 111 | 111 | $count / 2, |
| 112 | 112 | $end - $start, |
@@ -14,43 +14,43 @@ |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeMap; |
| 20 | 20 | |
| 21 | 21 | $tree = TreeMap::create()->put([1 => 1, 9 => 9, 5 => 5, 2 => 2, 6 => 6, 3 => 3, 0 => 0, 8 => 8, 7 => 7, 4 => 4]); |
| 22 | 22 | |
| 23 | 23 | // Print [0,1,2,3,4,5,6,7,8,9] |
| 24 | -echo $tree . PHP_EOL; |
|
| 24 | +echo $tree.PHP_EOL; |
|
| 25 | 25 | |
| 26 | 26 | // Print 0 |
| 27 | -echo $tree->firstKey . PHP_EOL; |
|
| 27 | +echo $tree->firstKey.PHP_EOL; |
|
| 28 | 28 | |
| 29 | 29 | // Print 9 |
| 30 | -echo $tree->lastValue . PHP_EOL; |
|
| 30 | +echo $tree->lastValue.PHP_EOL; |
|
| 31 | 31 | |
| 32 | 32 | // Print 10 |
| 33 | -echo count($tree) . PHP_EOL; |
|
| 33 | +echo count($tree).PHP_EOL; |
|
| 34 | 34 | |
| 35 | 35 | // Print 5 |
| 36 | -echo $tree[5] . PHP_EOL; |
|
| 36 | +echo $tree[5].PHP_EOL; |
|
| 37 | 37 | |
| 38 | 38 | // Change value for $tree[5] |
| 39 | 39 | $tree[5] = 10; |
| 40 | 40 | |
| 41 | 41 | // Print [0,1,2,3,4,10,6,7,8,9] |
| 42 | -echo $tree . PHP_EOL; |
|
| 42 | +echo $tree.PHP_EOL; |
|
| 43 | 43 | |
| 44 | 44 | // Unset $tree[5] |
| 45 | 45 | unset($tree[5]); |
| 46 | 46 | |
| 47 | 47 | // Print {"0":0,"1":1,"2":2,"3":3,"4":4,"6":6,"7":7,"8":8,"9":9} |
| 48 | -echo $tree . PHP_EOL; |
|
| 48 | +echo $tree.PHP_EOL; |
|
| 49 | 49 | |
| 50 | 50 | // Print 0-0;1-1;2-2;3-3;4-4;6-6;7-7;8-8;9-9; |
| 51 | 51 | foreach ($tree as $key => $value) |
| 52 | 52 | { |
| 53 | - echo $key . '-' . $value . ';'; |
|
| 53 | + echo $key.'-'.$value.';'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | echo PHP_EOL; |
@@ -14,43 +14,43 @@ |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeSet; |
| 20 | 20 | |
| 21 | 21 | $set = TreeSet::create()->put([1, 9, 5, 2, 6, 3, 0, 8, 7, 4]); |
| 22 | 22 | |
| 23 | 23 | // Print [0,1,2,3,4,5,6,7,8,9] |
| 24 | -echo $set . PHP_EOL; |
|
| 24 | +echo $set.PHP_EOL; |
|
| 25 | 25 | |
| 26 | 26 | // Print 0 |
| 27 | -echo $set->first . PHP_EOL; |
|
| 27 | +echo $set->first.PHP_EOL; |
|
| 28 | 28 | |
| 29 | 29 | // Print 9 |
| 30 | -echo $set->last . PHP_EOL; |
|
| 30 | +echo $set->last.PHP_EOL; |
|
| 31 | 31 | |
| 32 | 32 | // Print 10 |
| 33 | -echo count($set) . PHP_EOL; |
|
| 33 | +echo count($set).PHP_EOL; |
|
| 34 | 34 | |
| 35 | 35 | // Print 1 |
| 36 | -echo $set[5] . PHP_EOL; |
|
| 36 | +echo $set[5].PHP_EOL; |
|
| 37 | 37 | |
| 38 | 38 | // Change value for $set[5] |
| 39 | 39 | $set[5] = false; |
| 40 | 40 | |
| 41 | 41 | // Print [0,1,2,3,4,6,7,8,9] |
| 42 | -echo $set . PHP_EOL; |
|
| 42 | +echo $set.PHP_EOL; |
|
| 43 | 43 | |
| 44 | 44 | // Unset $set[6] |
| 45 | 45 | unset($set[6]); |
| 46 | 46 | |
| 47 | 47 | // Print [0,1,2,3,4,7,8,9] |
| 48 | -echo $set . PHP_EOL; |
|
| 48 | +echo $set.PHP_EOL; |
|
| 49 | 49 | |
| 50 | 50 | // Print 0-0;1-1;2-2;3-3;4-4;5-7;6-8;7-9; |
| 51 | 51 | foreach ($set as $key => $value) |
| 52 | 52 | { |
| 53 | - echo $key . '-' . $value . ';'; |
|
| 53 | + echo $key.'-'.$value.';'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | echo PHP_EOL; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeSet; |
| 20 | 20 | use chdemko\SortedCollection\ReversedSet; |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | $sub = SubSet::create($reversed, 7, 2); |
| 26 | 26 | |
| 27 | 27 | // Print [7,6,5,4,3] |
| 28 | -echo $sub . PHP_EOL; |
|
| 28 | +echo $sub.PHP_EOL; |
|
| 29 | 29 | |
| 30 | 30 | // Print [7,6,5,3] |
| 31 | 31 | unset($set[4]); |
| 32 | -echo $sub . PHP_EOL; |
|
| 32 | +echo $sub.PHP_EOL; |
|
| 33 | 33 | |
| 34 | 34 | // Print [9,8,7,6,5,3] |
| 35 | 35 | unset($sub->from); |
| 36 | -echo $sub . PHP_EOL; |
|
| 36 | +echo $sub.PHP_EOL; |
|
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeSet; |
| 20 | 20 | use chdemko\SortedCollection\ReversedSet; |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | $reversed = ReversedSet::create($set); |
| 24 | 24 | |
| 25 | 25 | // Print [9,8,7,6,5,4,3,2,1,0] |
| 26 | -echo $reversed . PHP_EOL; |
|
| 26 | +echo $reversed.PHP_EOL; |
|
| 27 | 27 | |
| 28 | 28 | // Print [8,7,6,5,4,3,2,1,0] |
| 29 | 29 | unset($set[9]); |
| 30 | -echo $reversed . PHP_EOL; |
|
| 30 | +echo $reversed.PHP_EOL; |
|
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeMap; |
| 20 | 20 | use chdemko\SortedCollection\ReversedMap; |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | $reversed = ReversedMap::create($tree); |
| 24 | 24 | |
| 25 | 25 | // Print {"9":9,"8":8,"7":7,"6":6,"5":5,"4":4,"3":3,"2":2,"1":1,"0":0} |
| 26 | -echo $reversed . PHP_EOL; |
|
| 26 | +echo $reversed.PHP_EOL; |
|
| 27 | 27 | |
| 28 | 28 | // Print {"8":8,"7":7,"6":6,"5":5,"4":4,"3":3,"2":2,"1":1,"0":0} |
| 29 | 29 | unset($tree[9]); |
| 30 | -echo $reversed . PHP_EOL; |
|
| 30 | +echo $reversed.PHP_EOL; |
|
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * This file is part of the php-sorted-collections package https://github.com/chdemko/php-sorted-collections |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 17 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 18 | 18 | |
| 19 | 19 | use chdemko\SortedCollection\TreeMap; |
| 20 | 20 | use chdemko\SortedCollection\ReversedMap; |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | $sub = SubMap::create($reversed, 7, 2); |
| 26 | 26 | |
| 27 | 27 | // Print {"7":7,"6":6,"5":5,"4":4,"3":3} |
| 28 | -echo $sub . PHP_EOL; |
|
| 28 | +echo $sub.PHP_EOL; |
|
| 29 | 29 | |
| 30 | 30 | // Print {"7":7,"6":6,"5":5,"3":3} |
| 31 | 31 | unset($tree[4]); |
| 32 | -echo $sub . PHP_EOL; |
|
| 32 | +echo $sub.PHP_EOL; |
|
| 33 | 33 | |
| 34 | 34 | // Print {"9":9,"8":8,"7":7,"6":6,"5":5,"3":3} |
| 35 | 35 | unset($sub->fromKey); |
| 36 | -echo $sub . PHP_EOL; |
|
| 36 | +echo $sub.PHP_EOL; |
|