├── .gitignore ├── composer.json ├── .github └── FUNDING.yml ├── test_array_rand.php ├── test_array_unique.php ├── LICENSE ├── test_string_replace.php ├── test_preg_match.php ├── test_string_quotation.php ├── README.md └── composer.lock /.gitignore: -------------------------------------------------------------------------------- 1 | composer.phar 2 | /vendor/ 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "bvanhoekelen/performance": "^2.5" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Sponsor this project 2 | 3 | github: [devmount] 4 | custom: ['https://paypal.me/devmount'] 5 | -------------------------------------------------------------------------------- /test_array_rand.php: -------------------------------------------------------------------------------- 1 | toJson())->points; 27 | $p2 = end($points); 28 | $p1 = prev($points); 29 | $percent = round(1-$p2->differenceTime/$p1->differenceTime,4)*100; 30 | $times = round($p1->differenceTime/$p2->differenceTime, 1); 31 | 32 | print_r('Alternative method is ' . $percent . '% (' . $times . 'x) faster' . "\n"); 33 | print_r('Generated test array with ' . count($a) . ' elements' . "\n"); 34 | -------------------------------------------------------------------------------- /test_array_unique.php: -------------------------------------------------------------------------------- 1 | toJson())->points; 29 | $p2 = end($points); 30 | $p1 = prev($points); 31 | $percent = round(1-$p2->differenceTime/$p1->differenceTime,4)*100; 32 | $times = round($p1->differenceTime/$p2->differenceTime, 1); 33 | 34 | print_r('Alternative method is ' . $percent . '% (' . $times . 'x) faster' . "\n"); 35 | print_r('Generated test array with ' . count($a) . ' elements having ' . count($result) . ' unique elements' . "\n"); 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Andreas Müller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test_string_replace.php: -------------------------------------------------------------------------------- 1 | toJson())->points; 34 | $p2 = end($points); 35 | $p1 = prev($points); 36 | $percent = round(1-$p2->differenceTime/$p1->differenceTime,4)*100; 37 | $times = round($p1->differenceTime/$p2->differenceTime, 1); 38 | 39 | print_r('Alternative method is ' . $percent . '% (' . $times . 'x) faster' . "\n"); 40 | print_r('Generated test array with ' . count($a) . ' random strings' . "\n"); 41 | -------------------------------------------------------------------------------- /test_preg_match.php: -------------------------------------------------------------------------------- 1 | toJson())->points; 33 | $p2 = end($points); 34 | $p1 = prev($points); 35 | $percent = round(1-$p2->differenceTime/$p1->differenceTime,4)*100; 36 | $times = round($p1->differenceTime/$p2->differenceTime, 1); 37 | 38 | print_r('Alternative method is ' . $percent . '% (' . $times . 'x) faster' . "\n"); 39 | print_r('Generated test array with ' . count($a) . ' elements' . "\n"); 40 | -------------------------------------------------------------------------------- /test_string_quotation.php: -------------------------------------------------------------------------------- 1 | 148 | - 149 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "a0d36dff49c4ed4b1982ab486a71190e", 8 | "packages": [ 9 | { 10 | "name": "bvanhoekelen/performance", 11 | "version": "v2.5.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/bvanhoekelen/performance.git", 15 | "reference": "597003c45bda39af79e8fc767eaabb6aa3784408" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/bvanhoekelen/performance/zipball/597003c45bda39af79e8fc767eaabb6aa3784408", 20 | "reference": "597003c45bda39af79e8fc767eaabb6aa3784408", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "bvanhoekelen/terminal-style": "^1.0", 25 | "php": ">=5.6.0" 26 | }, 27 | "require-dev": { 28 | "illuminate/database": "^5.4", 29 | "illuminate/events": "^5.4", 30 | "larapack/dd": "1.*", 31 | "phpunit/phpunit": "^5.7" 32 | }, 33 | "type": "library", 34 | "autoload": { 35 | "psr-4": { 36 | "Performance\\": "src/" 37 | } 38 | }, 39 | "notification-url": "https://packagist.org/downloads/", 40 | "license": [ 41 | "Apache-2.0" 42 | ], 43 | "authors": [ 44 | { 45 | "name": "B. van Hoekelen", 46 | "homepage": "https://github.com/bvanhoekelen/performance" 47 | } 48 | ], 49 | "description": "PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.", 50 | "keywords": [ 51 | "analyser", 52 | "command line", 53 | "compressor", 54 | "database", 55 | "database query log", 56 | "export", 57 | "laravel", 58 | "memory", 59 | "performance", 60 | "performance tool", 61 | "php", 62 | "php performance analyser", 63 | "php performance tool", 64 | "php-performance", 65 | "query", 66 | "query analyser", 67 | "query log", 68 | "terminal", 69 | "time", 70 | "web" 71 | ], 72 | "time": "2019-03-31T14:41:23+00:00" 73 | }, 74 | { 75 | "name": "bvanhoekelen/terminal-style", 76 | "version": "v1.0.4", 77 | "source": { 78 | "type": "git", 79 | "url": "https://github.com/bvanhoekelen/terminal-style.git", 80 | "reference": "e851be5b3c46f884be1096f9e01d3d5e90742194" 81 | }, 82 | "dist": { 83 | "type": "zip", 84 | "url": "https://api.github.com/repos/bvanhoekelen/terminal-style/zipball/e851be5b3c46f884be1096f9e01d3d5e90742194", 85 | "reference": "e851be5b3c46f884be1096f9e01d3d5e90742194", 86 | "shasum": "" 87 | }, 88 | "require": { 89 | "php": ">=5.4.0" 90 | }, 91 | "require-dev": { 92 | "larapack/dd": "1.*", 93 | "phpunit/phpunit": "^5.7" 94 | }, 95 | "type": "library", 96 | "autoload": { 97 | "files": [ 98 | "src/terminal-style.php" 99 | ] 100 | }, 101 | "notification-url": "https://packagist.org/downloads/", 102 | "license": [ 103 | "Apache-2.0" 104 | ], 105 | "authors": [ 106 | { 107 | "name": "B. van Hoekelen", 108 | "homepage": "https://github.com/bvanhoekelen/terminal-style" 109 | } 110 | ], 111 | "description": "Return your terminal message in style! Change the text style, text color and text background color form the terminal interface with ANSI color codes. The terminal style tool support Laravel and Composer.", 112 | "keywords": [ 113 | "8-bits background color", 114 | "ANSI color codes", 115 | "ansi", 116 | "bash", 117 | "colors", 118 | "command line", 119 | "command line colors", 120 | "command line style", 121 | "php", 122 | "php terminal colors", 123 | "php terminal style", 124 | "terminal", 125 | "terminal colors" 126 | ], 127 | "time": "2018-02-19T20:46:00+00:00" 128 | } 129 | ], 130 | "packages-dev": [], 131 | "aliases": [], 132 | "minimum-stability": "stable", 133 | "stability-flags": [], 134 | "prefer-stable": false, 135 | "prefer-lowest": false, 136 | "platform": [], 137 | "platform-dev": [] 138 | } 139 | --------------------------------------------------------------------------------