├── .gitattributes ├── .gitignore ├── LICENSE.md ├── README.md ├── RESULTS.md ├── bin └── composer ├── box.json ├── build.properties ├── build.xml ├── build └── phpbm.phar ├── composer.json ├── phpbm └── src ├── base ├── BenchmarkApp.php ├── BenchmarkBase.php ├── BenchmarkProgressBar.php ├── BenchmarkSuite.php └── BenchmarkTestGroup.php ├── benchmark ├── BenchmarkArraySortIntegers.php ├── BenchmarkArraySortStrings.php ├── BenchmarkCycles.php ├── BenchmarkFillArray.php ├── BenchmarkLongStrings.php ├── BenchmarkObjects.php ├── BenchmarkRand.php ├── BenchmarkStrExImplode.php ├── BenchmarkStrHash.php └── BenchmarkStrSimple.php └── phpbm.php /.gitattributes: -------------------------------------------------------------------------------- 1 | *.php diff=php 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/*.phar* 2 | build/*.tgz 3 | composer.lock 4 | vendor 5 | php-cli.error.log 6 | tags 7 | *.swp 8 | *.swo 9 | *.swn 10 | 11 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | ========================== 3 | 4 | Version 3, 29 June 2007 5 | 6 | Copyright © 2007 Free Software Foundation, Inc. <> 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this license 9 | document, but changing it is not allowed. 10 | 11 | ## Preamble 12 | 13 | The GNU General Public License is a free, copyleft license for software and other 14 | kinds of works. 15 | 16 | The licenses for most software and other practical works are designed to take away 17 | your freedom to share and change the works. By contrast, the GNU General Public 18 | License is intended to guarantee your freedom to share and change all versions of a 19 | program--to make sure it remains free software for all its users. We, the Free 20 | Software Foundation, use the GNU General Public License for most of our software; it 21 | applies also to any other work released this way by its authors. You can apply it to 22 | your programs, too. 23 | 24 | When we speak of free software, we are referring to freedom, not price. Our General 25 | Public Licenses are designed to make sure that you have the freedom to distribute 26 | copies of free software (and charge for them if you wish), that you receive source 27 | code or can get it if you want it, that you can change the software or use pieces of 28 | it in new free programs, and that you know you can do these things. 29 | 30 | To protect your rights, we need to prevent others from denying you these rights or 31 | asking you to surrender the rights. Therefore, you have certain responsibilities if 32 | you distribute copies of the software, or if you modify it: responsibilities to 33 | respect the freedom of others. 34 | 35 | For example, if you distribute copies of such a program, whether gratis or for a fee, 36 | you must pass on to the recipients the same freedoms that you received. You must make 37 | sure that they, too, receive or can get the source code. And you must show them these 38 | terms so they know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: (1) assert 41 | copyright on the software, and (2) offer you this License giving you legal permission 42 | to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains that there is 45 | no warranty for this free software. For both users' and authors' sake, the GPL 46 | requires that modified versions be marked as changed, so that their problems will not 47 | be attributed erroneously to authors of previous versions. 48 | 49 | Some devices are designed to deny users access to install or run modified versions of 50 | the software inside them, although the manufacturer can do so. This is fundamentally 51 | incompatible with the aim of protecting users' freedom to change the software. The 52 | systematic pattern of such abuse occurs in the area of products for individuals to 53 | use, which is precisely where it is most unacceptable. Therefore, we have designed 54 | this version of the GPL to prohibit the practice for those products. If such problems 55 | arise substantially in other domains, we stand ready to extend this provision to 56 | those domains in future versions of the GPL, as needed to protect the freedom of 57 | users. 58 | 59 | Finally, every program is threatened constantly by software patents. States should 60 | not allow patents to restrict development and use of software on general-purpose 61 | computers, but in those that do, we wish to avoid the special danger that patents 62 | applied to a free program could make it effectively proprietary. To prevent this, the 63 | GPL assures that patents cannot be used to render the program non-free. 64 | 65 | The precise terms and conditions for copying, distribution and modification follow. 66 | 67 | ## TERMS AND CONDITIONS 68 | 69 | ### 0. Definitions. 70 | 71 | “This License” refers to version 3 of the GNU General Public License. 72 | 73 | “Copyright” also means copyright-like laws that apply to other kinds of 74 | works, such as semiconductor masks. 75 | 76 | “The Program” refers to any copyrightable work licensed under this 77 | License. Each licensee is addressed as “you”. “Licensees” and 78 | “recipients” may be individuals or organizations. 79 | 80 | To “modify” a work means to copy from or adapt all or part of the work in 81 | a fashion requiring copyright permission, other than the making of an exact copy. The 82 | resulting work is called a “modified version” of the earlier work or a 83 | work “based on” the earlier work. 84 | 85 | A “covered work” means either the unmodified Program or a work based on 86 | the Program. 87 | 88 | To “propagate” a work means to do anything with it that, without 89 | permission, would make you directly or secondarily liable for infringement under 90 | applicable copyright law, except executing it on a computer or modifying a private 91 | copy. Propagation includes copying, distribution (with or without modification), 92 | making available to the public, and in some countries other activities as well. 93 | 94 | To “convey” a work means any kind of propagation that enables other 95 | parties to make or receive copies. Mere interaction with a user through a computer 96 | network, with no transfer of a copy, is not conveying. 97 | 98 | An interactive user interface displays “Appropriate Legal Notices” to the 99 | extent that it includes a convenient and prominently visible feature that (1) 100 | displays an appropriate copyright notice, and (2) tells the user that there is no 101 | warranty for the work (except to the extent that warranties are provided), that 102 | licensees may convey the work under this License, and how to view a copy of this 103 | License. If the interface presents a list of user commands or options, such as a 104 | menu, a prominent item in the list meets this criterion. 105 | 106 | ### 1. Source Code. 107 | 108 | The “source code” for a work means the preferred form of the work for 109 | making modifications to it. “Object code” means any non-source form of a 110 | work. 111 | 112 | A “Standard Interface” means an interface that either is an official 113 | standard defined by a recognized standards body, or, in the case of interfaces 114 | specified for a particular programming language, one that is widely used among 115 | developers working in that language. 116 | 117 | The “System Libraries” of an executable work include anything, other than 118 | the work as a whole, that (a) is included in the normal form of packaging a Major 119 | Component, but which is not part of that Major Component, and (b) serves only to 120 | enable use of the work with that Major Component, or to implement a Standard 121 | Interface for which an implementation is available to the public in source code form. 122 | A “Major Component”, in this context, means a major essential component 123 | (kernel, window system, and so on) of the specific operating system (if any) on which 124 | the executable work runs, or a compiler used to produce the work, or an object code 125 | interpreter used to run it. 126 | 127 | The “Corresponding Source” for a work in object code form means all the 128 | source code needed to generate, install, and (for an executable work) run the object 129 | code and to modify the work, including scripts to control those activities. However, 130 | it does not include the work's System Libraries, or general-purpose tools or 131 | generally available free programs which are used unmodified in performing those 132 | activities but which are not part of the work. For example, Corresponding Source 133 | includes interface definition files associated with source files for the work, and 134 | the source code for shared libraries and dynamically linked subprograms that the work 135 | is specifically designed to require, such as by intimate data communication or 136 | control flow between those subprograms and other parts of the work. 137 | 138 | The Corresponding Source need not include anything that users can regenerate 139 | automatically from other parts of the Corresponding Source. 140 | 141 | The Corresponding Source for a work in source code form is that same work. 142 | 143 | ### 2. Basic Permissions. 144 | 145 | All rights granted under this License are granted for the term of copyright on the 146 | Program, and are irrevocable provided the stated conditions are met. This License 147 | explicitly affirms your unlimited permission to run the unmodified Program. The 148 | output from running a covered work is covered by this License only if the output, 149 | given its content, constitutes a covered work. This License acknowledges your rights 150 | of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not convey, without 153 | conditions so long as your license otherwise remains in force. You may convey covered 154 | works to others for the sole purpose of having them make modifications exclusively 155 | for you, or provide you with facilities for running those works, provided that you 156 | comply with the terms of this License in conveying all material for which you do not 157 | control copyright. Those thus making or running the covered works for you must do so 158 | exclusively on your behalf, under your direction and control, on terms that prohibit 159 | them from making any copies of your copyrighted material outside their relationship 160 | with you. 161 | 162 | Conveying under any other circumstances is permitted solely under the conditions 163 | stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 164 | 165 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 166 | 167 | No covered work shall be deemed part of an effective technological measure under any 168 | applicable law fulfilling obligations under article 11 of the WIPO copyright treaty 169 | adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention 170 | of such measures. 171 | 172 | When you convey a covered work, you waive any legal power to forbid circumvention of 173 | technological measures to the extent such circumvention is effected by exercising 174 | rights under this License with respect to the covered work, and you disclaim any 175 | intention to limit operation or modification of the work as a means of enforcing, 176 | against the work's users, your or third parties' legal rights to forbid circumvention 177 | of technological measures. 178 | 179 | ### 4. Conveying Verbatim Copies. 180 | 181 | You may convey verbatim copies of the Program's source code as you receive it, in any 182 | medium, provided that you conspicuously and appropriately publish on each copy an 183 | appropriate copyright notice; keep intact all notices stating that this License and 184 | any non-permissive terms added in accord with section 7 apply to the code; keep 185 | intact all notices of the absence of any warranty; and give all recipients a copy of 186 | this License along with the Program. 187 | 188 | You may charge any price or no price for each copy that you convey, and you may offer 189 | support or warranty protection for a fee. 190 | 191 | ### 5. Conveying Modified Source Versions. 192 | 193 | You may convey a work based on the Program, or the modifications to produce it from 194 | the Program, in the form of source code under the terms of section 4, provided that 195 | you also meet all of these conditions: 196 | 197 | * **a)** The work must carry prominent notices stating that you modified it, and giving a 198 | relevant date. 199 | * **b)** The work must carry prominent notices stating that it is released under this 200 | License and any conditions added under section 7. This requirement modifies the 201 | requirement in section 4 to “keep intact all notices”. 202 | * **c)** You must license the entire work, as a whole, under this License to anyone who 203 | comes into possession of a copy. This License will therefore apply, along with any 204 | applicable section 7 additional terms, to the whole of the work, and all its parts, 205 | regardless of how they are packaged. This License gives no permission to license the 206 | work in any other way, but it does not invalidate such permission if you have 207 | separately received it. 208 | * **d)** If the work has interactive user interfaces, each must display Appropriate Legal 209 | Notices; however, if the Program has interactive interfaces that do not display 210 | Appropriate Legal Notices, your work need not make them do so. 211 | 212 | A compilation of a covered work with other separate and independent works, which are 213 | not by their nature extensions of the covered work, and which are not combined with 214 | it such as to form a larger program, in or on a volume of a storage or distribution 215 | medium, is called an “aggregate” if the compilation and its resulting 216 | copyright are not used to limit the access or legal rights of the compilation's users 217 | beyond what the individual works permit. Inclusion of a covered work in an aggregate 218 | does not cause this License to apply to the other parts of the aggregate. 219 | 220 | ### 6. Conveying Non-Source Forms. 221 | 222 | You may convey a covered work in object code form under the terms of sections 4 and 223 | 5, provided that you also convey the machine-readable Corresponding Source under the 224 | terms of this License, in one of these ways: 225 | 226 | * **a)** Convey the object code in, or embodied in, a physical product (including a 227 | physical distribution medium), accompanied by the Corresponding Source fixed on a 228 | durable physical medium customarily used for software interchange. 229 | * **b)** Convey the object code in, or embodied in, a physical product (including a 230 | physical distribution medium), accompanied by a written offer, valid for at least 231 | three years and valid for as long as you offer spare parts or customer support for 232 | that product model, to give anyone who possesses the object code either (1) a copy of 233 | the Corresponding Source for all the software in the product that is covered by this 234 | License, on a durable physical medium customarily used for software interchange, for 235 | a price no more than your reasonable cost of physically performing this conveying of 236 | source, or (2) access to copy the Corresponding Source from a network server at no 237 | charge. 238 | * **c)** Convey individual copies of the object code with a copy of the written offer to 239 | provide the Corresponding Source. This alternative is allowed only occasionally and 240 | noncommercially, and only if you received the object code with such an offer, in 241 | accord with subsection 6b. 242 | * **d)** Convey the object code by offering access from a designated place (gratis or for 243 | a charge), and offer equivalent access to the Corresponding Source in the same way 244 | through the same place at no further charge. You need not require recipients to copy 245 | the Corresponding Source along with the object code. If the place to copy the object 246 | code is a network server, the Corresponding Source may be on a different server 247 | (operated by you or a third party) that supports equivalent copying facilities, 248 | provided you maintain clear directions next to the object code saying where to find 249 | the Corresponding Source. Regardless of what server hosts the Corresponding Source, 250 | you remain obligated to ensure that it is available for as long as needed to satisfy 251 | these requirements. 252 | * **e)** Convey the object code using peer-to-peer transmission, provided you inform 253 | other peers where the object code and Corresponding Source of the work are being 254 | offered to the general public at no charge under subsection 6d. 255 | 256 | A separable portion of the object code, whose source code is excluded from the 257 | Corresponding Source as a System Library, need not be included in conveying the 258 | object code work. 259 | 260 | A “User Product” is either (1) a “consumer product”, which 261 | means any tangible personal property which is normally used for personal, family, or 262 | household purposes, or (2) anything designed or sold for incorporation into a 263 | dwelling. In determining whether a product is a consumer product, doubtful cases 264 | shall be resolved in favor of coverage. For a particular product received by a 265 | particular user, “normally used” refers to a typical or common use of 266 | that class of product, regardless of the status of the particular user or of the way 267 | in which the particular user actually uses, or expects or is expected to use, the 268 | product. A product is a consumer product regardless of whether the product has 269 | substantial commercial, industrial or non-consumer uses, unless such uses represent 270 | the only significant mode of use of the product. 271 | 272 | “Installation Information” for a User Product means any methods, 273 | procedures, authorization keys, or other information required to install and execute 274 | modified versions of a covered work in that User Product from a modified version of 275 | its Corresponding Source. The information must suffice to ensure that the continued 276 | functioning of the modified object code is in no case prevented or interfered with 277 | solely because modification has been made. 278 | 279 | If you convey an object code work under this section in, or with, or specifically for 280 | use in, a User Product, and the conveying occurs as part of a transaction in which 281 | the right of possession and use of the User Product is transferred to the recipient 282 | in perpetuity or for a fixed term (regardless of how the transaction is 283 | characterized), the Corresponding Source conveyed under this section must be 284 | accompanied by the Installation Information. But this requirement does not apply if 285 | neither you nor any third party retains the ability to install modified object code 286 | on the User Product (for example, the work has been installed in ROM). 287 | 288 | The requirement to provide Installation Information does not include a requirement to 289 | continue to provide support service, warranty, or updates for a work that has been 290 | modified or installed by the recipient, or for the User Product in which it has been 291 | modified or installed. Access to a network may be denied when the modification itself 292 | materially and adversely affects the operation of the network or violates the rules 293 | and protocols for communication across the network. 294 | 295 | Corresponding Source conveyed, and Installation Information provided, in accord with 296 | this section must be in a format that is publicly documented (and with an 297 | implementation available to the public in source code form), and must require no 298 | special password or key for unpacking, reading or copying. 299 | 300 | ### 7. Additional Terms. 301 | 302 | “Additional permissions” are terms that supplement the terms of this 303 | License by making exceptions from one or more of its conditions. Additional 304 | permissions that are applicable to the entire Program shall be treated as though they 305 | were included in this License, to the extent that they are valid under applicable 306 | law. If additional permissions apply only to part of the Program, that part may be 307 | used separately under those permissions, but the entire Program remains governed by 308 | this License without regard to the additional permissions. 309 | 310 | When you convey a copy of a covered work, you may at your option remove any 311 | additional permissions from that copy, or from any part of it. (Additional 312 | permissions may be written to require their own removal in certain cases when you 313 | modify the work.) You may place additional permissions on material, added by you to a 314 | covered work, for which you have or can give appropriate copyright permission. 315 | 316 | Notwithstanding any other provision of this License, for material you add to a 317 | covered work, you may (if authorized by the copyright holders of that material) 318 | supplement the terms of this License with terms: 319 | 320 | * **a)** Disclaiming warranty or limiting liability differently from the terms of 321 | sections 15 and 16 of this License; or 322 | * **b)** Requiring preservation of specified reasonable legal notices or author 323 | attributions in that material or in the Appropriate Legal Notices displayed by works 324 | containing it; or 325 | * **c)** Prohibiting misrepresentation of the origin of that material, or requiring that 326 | modified versions of such material be marked in reasonable ways as different from the 327 | original version; or 328 | * **d)** Limiting the use for publicity purposes of names of licensors or authors of the 329 | material; or 330 | * **e)** Declining to grant rights under trademark law for use of some trade names, 331 | trademarks, or service marks; or 332 | * **f)** Requiring indemnification of licensors and authors of that material by anyone 333 | who conveys the material (or modified versions of it) with contractual assumptions of 334 | liability to the recipient, for any liability that these contractual assumptions 335 | directly impose on those licensors and authors. 336 | 337 | All other non-permissive additional terms are considered “further 338 | restrictions” within the meaning of section 10. If the Program as you received 339 | it, or any part of it, contains a notice stating that it is governed by this License 340 | along with a term that is a further restriction, you may remove that term. If a 341 | license document contains a further restriction but permits relicensing or conveying 342 | under this License, you may add to a covered work material governed by the terms of 343 | that license document, provided that the further restriction does not survive such 344 | relicensing or conveying. 345 | 346 | If you add terms to a covered work in accord with this section, you must place, in 347 | the relevant source files, a statement of the additional terms that apply to those 348 | files, or a notice indicating where to find the applicable terms. 349 | 350 | Additional terms, permissive or non-permissive, may be stated in the form of a 351 | separately written license, or stated as exceptions; the above requirements apply 352 | either way. 353 | 354 | ### 8. Termination. 355 | 356 | You may not propagate or modify a covered work except as expressly provided under 357 | this License. Any attempt otherwise to propagate or modify it is void, and will 358 | automatically terminate your rights under this License (including any patent licenses 359 | granted under the third paragraph of section 11). 360 | 361 | However, if you cease all violation of this License, then your license from a 362 | particular copyright holder is reinstated (a) provisionally, unless and until the 363 | copyright holder explicitly and finally terminates your license, and (b) permanently, 364 | if the copyright holder fails to notify you of the violation by some reasonable means 365 | prior to 60 days after the cessation. 366 | 367 | Moreover, your license from a particular copyright holder is reinstated permanently 368 | if the copyright holder notifies you of the violation by some reasonable means, this 369 | is the first time you have received notice of violation of this License (for any 370 | work) from that copyright holder, and you cure the violation prior to 30 days after 371 | your receipt of the notice. 372 | 373 | Termination of your rights under this section does not terminate the licenses of 374 | parties who have received copies or rights from you under this License. If your 375 | rights have been terminated and not permanently reinstated, you do not qualify to 376 | receive new licenses for the same material under section 10. 377 | 378 | ### 9. Acceptance Not Required for Having Copies. 379 | 380 | You are not required to accept this License in order to receive or run a copy of the 381 | Program. Ancillary propagation of a covered work occurring solely as a consequence of 382 | using peer-to-peer transmission to receive a copy likewise does not require 383 | acceptance. However, nothing other than this License grants you permission to 384 | propagate or modify any covered work. These actions infringe copyright if you do not 385 | accept this License. Therefore, by modifying or propagating a covered work, you 386 | indicate your acceptance of this License to do so. 387 | 388 | ### 10. Automatic Licensing of Downstream Recipients. 389 | 390 | Each time you convey a covered work, the recipient automatically receives a license 391 | from the original licensors, to run, modify and propagate that work, subject to this 392 | License. You are not responsible for enforcing compliance by third parties with this 393 | License. 394 | 395 | An “entity transaction” is a transaction transferring control of an 396 | organization, or substantially all assets of one, or subdividing an organization, or 397 | merging organizations. If propagation of a covered work results from an entity 398 | transaction, each party to that transaction who receives a copy of the work also 399 | receives whatever licenses to the work the party's predecessor in interest had or 400 | could give under the previous paragraph, plus a right to possession of the 401 | Corresponding Source of the work from the predecessor in interest, if the predecessor 402 | has it or can get it with reasonable efforts. 403 | 404 | You may not impose any further restrictions on the exercise of the rights granted or 405 | affirmed under this License. For example, you may not impose a license fee, royalty, 406 | or other charge for exercise of rights granted under this License, and you may not 407 | initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging 408 | that any patent claim is infringed by making, using, selling, offering for sale, or 409 | importing the Program or any portion of it. 410 | 411 | ### 11. Patents. 412 | 413 | A “contributor” is a copyright holder who authorizes use under this 414 | License of the Program or a work on which the Program is based. The work thus 415 | licensed is called the contributor's “contributor version”. 416 | 417 | A contributor's “essential patent claims” are all patent claims owned or 418 | controlled by the contributor, whether already acquired or hereafter acquired, that 419 | would be infringed by some manner, permitted by this License, of making, using, or 420 | selling its contributor version, but do not include claims that would be infringed 421 | only as a consequence of further modification of the contributor version. For 422 | purposes of this definition, “control” includes the right to grant patent 423 | sublicenses in a manner consistent with the requirements of this License. 424 | 425 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license 426 | under the contributor's essential patent claims, to make, use, sell, offer for sale, 427 | import and otherwise run, modify and propagate the contents of its contributor 428 | version. 429 | 430 | In the following three paragraphs, a “patent license” is any express 431 | agreement or commitment, however denominated, not to enforce a patent (such as an 432 | express permission to practice a patent or covenant not to sue for patent 433 | infringement). To “grant” such a patent license to a party means to make 434 | such an agreement or commitment not to enforce a patent against the party. 435 | 436 | If you convey a covered work, knowingly relying on a patent license, and the 437 | Corresponding Source of the work is not available for anyone to copy, free of charge 438 | and under the terms of this License, through a publicly available network server or 439 | other readily accessible means, then you must either (1) cause the Corresponding 440 | Source to be so available, or (2) arrange to deprive yourself of the benefit of the 441 | patent license for this particular work, or (3) arrange, in a manner consistent with 442 | the requirements of this License, to extend the patent license to downstream 443 | recipients. “Knowingly relying” means you have actual knowledge that, but 444 | for the patent license, your conveying the covered work in a country, or your 445 | recipient's use of the covered work in a country, would infringe one or more 446 | identifiable patents in that country that you have reason to believe are valid. 447 | 448 | If, pursuant to or in connection with a single transaction or arrangement, you 449 | convey, or propagate by procuring conveyance of, a covered work, and grant a patent 450 | license to some of the parties receiving the covered work authorizing them to use, 451 | propagate, modify or convey a specific copy of the covered work, then the patent 452 | license you grant is automatically extended to all recipients of the covered work and 453 | works based on it. 454 | 455 | A patent license is “discriminatory” if it does not include within the 456 | scope of its coverage, prohibits the exercise of, or is conditioned on the 457 | non-exercise of one or more of the rights that are specifically granted under this 458 | License. You may not convey a covered work if you are a party to an arrangement with 459 | a third party that is in the business of distributing software, under which you make 460 | payment to the third party based on the extent of your activity of conveying the 461 | work, and under which the third party grants, to any of the parties who would receive 462 | the covered work from you, a discriminatory patent license (a) in connection with 463 | copies of the covered work conveyed by you (or copies made from those copies), or (b) 464 | primarily for and in connection with specific products or compilations that contain 465 | the covered work, unless you entered into that arrangement, or that patent license 466 | was granted, prior to 28 March 2007. 467 | 468 | Nothing in this License shall be construed as excluding or limiting any implied 469 | license or other defenses to infringement that may otherwise be available to you 470 | under applicable patent law. 471 | 472 | ### 12. No Surrender of Others' Freedom. 473 | 474 | If conditions are imposed on you (whether by court order, agreement or otherwise) 475 | that contradict the conditions of this License, they do not excuse you from the 476 | conditions of this License. If you cannot convey a covered work so as to satisfy 477 | simultaneously your obligations under this License and any other pertinent 478 | obligations, then as a consequence you may not convey it at all. For example, if you 479 | agree to terms that obligate you to collect a royalty for further conveying from 480 | those to whom you convey the Program, the only way you could satisfy both those terms 481 | and this License would be to refrain entirely from conveying the Program. 482 | 483 | ### 13. Use with the GNU Affero General Public License. 484 | 485 | Notwithstanding any other provision of this License, you have permission to link or 486 | combine any covered work with a work licensed under version 3 of the GNU Affero 487 | General Public License into a single combined work, and to convey the resulting work. 488 | The terms of this License will continue to apply to the part which is the covered 489 | work, but the special requirements of the GNU Affero General Public License, section 490 | 13, concerning interaction through a network will apply to the combination as such. 491 | 492 | ### 14. Revised Versions of this License. 493 | 494 | The Free Software Foundation may publish revised and/or new versions of the GNU 495 | General Public License from time to time. Such new versions will be similar in spirit 496 | to the present version, but may differ in detail to address new problems or concerns. 497 | 498 | Each version is given a distinguishing version number. If the Program specifies that 499 | a certain numbered version of the GNU General Public License “or any later 500 | version” applies to it, you have the option of following the terms and 501 | conditions either of that numbered version or of any later version published by the 502 | Free Software Foundation. If the Program does not specify a version number of the GNU 503 | General Public License, you may choose any version ever published by the Free 504 | Software Foundation. 505 | 506 | If the Program specifies that a proxy can decide which future versions of the GNU 507 | General Public License can be used, that proxy's public statement of acceptance of a 508 | version permanently authorizes you to choose that version for the Program. 509 | 510 | Later license versions may give you additional or different permissions. However, no 511 | additional obligations are imposed on any author or copyright holder as a result of 512 | your choosing to follow a later version. 513 | 514 | ### 15. Disclaimer of Warranty. 515 | 516 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 517 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 518 | PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER 519 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 520 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 521 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 522 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 523 | 524 | ### 16. Limitation of Liability. 525 | 526 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY 527 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS 528 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 529 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 530 | PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE 531 | OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE 532 | WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 533 | POSSIBILITY OF SUCH DAMAGES. 534 | 535 | ### 17. Interpretation of Sections 15 and 16. 536 | 537 | If the disclaimer of warranty and limitation of liability provided above cannot be 538 | given local legal effect according to their terms, reviewing courts shall apply local 539 | law that most closely approximates an absolute waiver of all civil liability in 540 | connection with the Program, unless a warranty or assumption of liability accompanies 541 | a copy of the Program in return for a fee. 542 | 543 | END OF TERMS AND CONDITIONS 544 | 545 | ## How to Apply These Terms to Your New Programs 546 | 547 | If you develop a new program, and you want it to be of the greatest possible use to 548 | the public, the best way to achieve this is to make it free software which everyone 549 | can redistribute and change under these terms. 550 | 551 | To do so, attach the following notices to the program. It is safest to attach them 552 | to the start of each source file to most effectively state the exclusion of warranty; 553 | and each file should have at least the “copyright” line and a pointer to 554 | where the full notice is found. 555 | 556 | 557 | Copyright (C) 558 | 559 | This program is free software: you can redistribute it and/or modify 560 | it under the terms of the GNU General Public License as published by 561 | the Free Software Foundation, either version 3 of the License, or 562 | (at your option) any later version. 563 | 564 | This program is distributed in the hope that it will be useful, 565 | but WITHOUT ANY WARRANTY; without even the implied warranty of 566 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 567 | GNU General Public License for more details. 568 | 569 | You should have received a copy of the GNU General Public License 570 | along with this program. If not, see . 571 | 572 | Also add information on how to contact you by electronic and paper mail. 573 | 574 | If the program does terminal interaction, make it output a short notice like this 575 | when it starts in an interactive mode: 576 | 577 | Copyright (C) 578 | This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. 579 | This is free software, and you are welcome to redistribute it 580 | under certain conditions; type 'show c' for details. 581 | 582 | The hypothetical commands 'show w' and 'show c' should show the appropriate parts of 583 | the General Public License. Of course, your program's commands might be different; 584 | for a GUI interface, you would use an “about box”. 585 | 586 | You should also get your employer (if you work as a programmer) or school, if any, to 587 | sign a “copyright disclaimer” for the program, if necessary. For more 588 | information on this, and how to apply and follow the GNU GPL, see 589 | <>. 590 | 591 | The GNU General Public License does not permit incorporating your program into 592 | proprietary programs. If your program is a subroutine library, you may consider it 593 | more useful to permit linking proprietary applications with the library. If this is 594 | what you want to do, use the GNU Lesser General Public License instead of this 595 | License. But first, please read 596 | <>. 597 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AF's PHP Benchmark tool 2 | This simple script allows you to measure the php performance on the server quickly. It measures the performance of the CPU by using the different php functions. 3 | 4 | # Usage 5 | Just download the latest phar build: 6 | https://github.com/florinsky/af-php-bench/raw/master/build/phpbm.phar 7 | 8 | Run: 9 | >chmod +x phpbm.phar 10 | 11 | >./phpbm.phar 12 | 13 | # Result Example 14 | ```` 15 | [GENERAL] 16 | 1/10 Cycles (if, while, do) ..................... 28.83s 17 | 2/10 Generate Random Numbers .................... 20.01s 18 | 3/10 Objects .................................... 12.49s 19 | Time: .. 61.33 20 | 21 | [STRINGS] 22 | 4/10 Simple Strings Functions ................... 26.47s 23 | 5/10 Explode/Implode ............................ 25.84s 24 | 6/10 Long Strings ............................... 30.04s 25 | 7/10 String Hash ................................ 22.08s 26 | Time: . 104.43 27 | 28 | [ARRAYS] 29 | 8/10 Fill arrays ................................ 25.22s 30 | 9/10 Array Sort (Integer Keys and Values) ....... 26.16s 31 | 10/10 Array Sort (String Keys and Values) ........ 27.53s 32 | Time: .. 78.91 33 | 34 | TOTAL TIME: . 244.66 35 | ```` 36 | 37 | [See Real Result](RESULTS.md) 38 | 39 | # Author 40 | Alexey Florinsky 41 | idc@inbox.ru 42 | 43 | Feel free to send me your result with hardware description! 44 | 45 | Thank you! 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /RESULTS.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | | NUC i5 | VB on NUC i5 | VMware on i7-4790K | Virtual on Xeon X5675 | Virtual on Xeon X3440 | MacBook Pro 2015 PHP55| MacBook Pro 2015 PHP70 4 | ----------|--------|--------------|--------------------|------------------------|----------------------|--------|------- 5 | General | 61 | 107 | 42 | 18 | 142 | 15 |8 6 | Strings | 104 | 144 | 152 | 52 | 134 | 81 |18 7 | Arrays | 79 | 86 | 51 | 56 | 129 | 52 |19 8 | Time (sec)| 245 | 338 | 246 | 126 | 407 | 148 |45 9 | 10 | # NUC i5 11 | Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz 12 | ```` 13 | [GENERAL] 14 | 1/10 Cycles (if, while, do) ..................... 28.83s 15 | 2/10 Generate Random Numbers .................... 20.01s 16 | 3/10 Objects .................................... 12.49s 17 | Time: .. 61.33 18 | 19 | [STRINGS] 20 | 4/10 Simple Strings Functions ................... 26.47s 21 | 5/10 Explode/Implode ............................ 25.84s 22 | 6/10 Long Strings ............................... 30.04s 23 | 7/10 String Hash ................................ 22.08s 24 | Time: . 104.43 25 | 26 | [ARRAYS] 27 | 8/10 Fill arrays ................................ 25.22s 28 | 9/10 Array Sort (Integer Keys and Values) ....... 26.16s 29 | 10/10 Array Sort (String Keys and Values) ........ 27.53s 30 | Time: .. 78.91 31 | 32 | TOTAL TIME: . 244.66 33 | ```` 34 | 35 | # VirtualBox Server based on NUC i5 36 | Full CPU usage 100% (Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz) 37 | ```` 38 | [GENERAL] 39 | 1/10 Cycles (if, while, do) ..................... 29.04s 40 | 2/10 Generate Random Numbers .................... 66.24s 41 | 3/10 Objects .................................... 12.68s 42 | Time: . 107.96 43 | 44 | [STRINGS] 45 | 4/10 Simple Strings Functions ................... 63.56s 46 | 5/10 Explode/Implode ............................ 26.18s 47 | 6/10 Long Strings ............................... 32.35s 48 | 7/10 String Hash ................................ 22.22s 49 | Time: . 144.31 50 | 51 | [ARRAYS] 52 | 8/10 Fill arrays ................................ 25.28s 53 | 9/10 Array Sort (Integer Keys and Values) ....... 30.06s 54 | 10/10 Array Sort (String Keys and Values) ........ 30.88s 55 | Time: .. 86.22 56 | 57 | TOTAL TIME: . 338.49 58 | ```` 59 | 60 | You can see the slow random generator and simple string functions. On other tests there is about 10% overhead. 61 | 62 | # VMware Player on Core i7 63 | Virtual Ubuntu server on Core i7-4790K 4.00Ghz 64 | ```` 65 | [GENERAL] 66 | 1/10 Cycles (if, while, do) ..................... 18.41s 67 | 2/10 Generate Random Numbers .................... 16.13s 68 | 3/10 Objects ..................................... 8.07s 69 | Time: .. 42.60 70 | 71 | [STRINGS] 72 | 4/10 Simple Strings Functions ................... 20.57s 73 | 5/10 Explode/Implode ............................ 16.17s 74 | 6/10 Long Strings .............................. 102.61s 75 | 7/10 String Hash ................................ 13.39s 76 | Time: . 152.74 77 | 78 | [ARRAYS] 79 | 8/10 Fill arrays ................................ 16.90s 80 | 9/10 Array Sort (Integer Keys and Values) ....... 16.79s 81 | 10/10 Array Sort (String Keys and Values) ........ 17.68s 82 | Time: .. 51.37 83 | 84 | TOTAL TIME: . 246.72 85 | ```` 86 | 87 | Good result except Long String test (concatenation of long strings). It is a strange behavoir of VMware player. 88 | 89 | # Virtual Server on Xeon X5675 90 | Virtual LAMP Server on the Intel(R) Xeon(R) CPU X5675 @ 3.07GHz, 91 | PHP 5.4.45-0+deb7u1 (cli) (built: Sep 10 2015 08:34:47), 92 | Zend Engine v2.4.0 93 | ```` 94 | [GENERAL] 95 | 1/10 Cycles (if, while, do) ...................... 9.69s 96 | 2/10 Generate Random Numbers ..................... 3.55s 97 | 3/10 Objects ..................................... 5.15s 98 | Time: .. 18.39 99 | 100 | [STRINGS] 101 | 4/10 Simple Strings Functions ................... 12.96s 102 | 5/10 Explode/Implode ............................ 15.95s 103 | 6/10 Long Strings ................................ 5.65s 104 | 7/10 String Hash ................................ 17.98s 105 | Time: .. 52.54 106 | 107 | [ARRAYS] 108 | 8/10 Fill arrays ................................ 17.20s 109 | 9/10 Array Sort (Integer Keys and Values) ....... 21.03s 110 | 10/10 Array Sort (String Keys and Values) ........ 17.59s 111 | Time: .. 55.83 112 | 113 | TOTAL TIME: . 126.75 114 | ```` 115 | Excellent result! 116 | 117 | # Virtual Server on Xeon X3440 118 | Virtual LAMP Server, OpenVZ, on the Intel(R) Xeon(R) CPU X3440 @ 2.53GHz, 119 | PHP 5.5.26-1+deb.sury.org~precise+1 (cli) (built: Jun 15 2015 10:04:48), 120 | Zend Engine v2.5.0 with Zend OPcache v7.0.6-dev 121 | ```` 122 | [GENERAL] 123 | 1/10 Cycles (if, while, do) ..................... 76.12s 124 | 2/10 Generate Random Numbers .................... 40.10s 125 | 3/10 Objects .................................... 26.65s 126 | Time: . 142.87 127 | 128 | [STRINGS] 129 | 4/10 Simple Strings Functions ................... 42.85s 130 | 5/10 Explode/Implode ............................ 32.25s 131 | 6/10 Long Strings ............................... 33.35s 132 | 7/10 String Hash ................................ 26.35s 133 | Time: . 134.81 134 | 135 | [ARRAYS] 136 | 8/10 Fill arrays ................................ 50.65s 137 | 9/10 Array Sort (Integer Keys and Values) ....... 42.52s 138 | 10/10 Array Sort (String Keys and Values) ........ 36.25s 139 | Time: . 129.43 140 | 141 | TOTAL TIME: . 407.10 142 | ```` 143 | 144 | # MacBook Pro (2015) 145 | CPU 2.9 GHz Intel Core i5, 146 | PHP 5.5.27 (cli) (built: Aug 22 2015 18:20:44) 147 | ```` 148 | AF's PHP Benchmark tool :) (idc@inbox.ru) version 1.0.0 149 | 150 | [GENERAL] 151 | 1/10 Cycles (if, while, do) ...................... 6.50s 152 | 2/10 Generate Random Numbers ..................... 3.20s 153 | 3/10 Objects ..................................... 4.73s 154 | Time: .. 14.44 155 | 156 | [STRINGS] 157 | 4/10 Simple Strings Functions ................... 12.70s 158 | 5/10 Explode/Implode ............................ 15.56s 159 | 6/10 Long Strings ............................... 29.52s 160 | 7/10 String Hash ................................ 23.40s 161 | Time: .. 81.18 162 | 163 | [ARRAYS] 164 | 8/10 Fill arrays ................................ 21.95s 165 | 9/10 Array Sort (Integer Keys and Values) ....... 16.43s 166 | 10/10 Array Sort (String Keys and Values) ........ 14.10s 167 | Time: .. 52.49 168 | 169 | TOTAL TIME: . 148.10 170 | ```` 171 | 172 | # MacBook Pro (2015) 173 | CPU 2.9 GHz Intel Core i5, 174 | PHP 7.0.3 (cli) (built: Feb 8 2016 04:09:22) ( NTS ) 175 | ```` 176 | [GENERAL] 177 | 1/10 Cycles (if, while, do) ...................... 3.87s 178 | 2/10 Generate Random Numbers ..................... 1.41s 179 | 3/10 Objects ..................................... 2.33s 180 | Time: ... 7.61 181 | 182 | [STRINGS] 183 | 4/10 Simple Strings Functions .................... 9.29s 184 | 5/10 Explode/Implode ............................. 4.22s 185 | 6/10 Long Strings ................................ 4.53s 186 | 7/10 String Hash ................................. 0.05s 187 | Time: .. 18.10 188 | 189 | [ARRAYS] 190 | 8/10 Fill arrays ................................. 4.26s 191 | 9/10 Array Sort (Integer Keys and Values) ........ 6.85s 192 | 10/10 Array Sort (String Keys and Values) ......... 7.57s 193 | Time: .. 18.68 194 | 195 | TOTAL TIME: .. 44.40 196 | ```` 197 | -------------------------------------------------------------------------------- /bin/composer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florinsky/af-php-bench/d20c52477772f9e8918b9b9aebcb429ce99f5de0/bin/composer -------------------------------------------------------------------------------- /box.json: -------------------------------------------------------------------------------- 1 | { 2 | "chmod": "0755", 3 | "directories": [ 4 | "src", 5 | "vendor" 6 | ], 7 | "main": "phpbm", 8 | "output": "phpbm.phar", 9 | "stub": true 10 | } 11 | -------------------------------------------------------------------------------- /build.properties: -------------------------------------------------------------------------------- 1 | bin.composer=bin/composer 2 | 3 | dir.src=src 4 | dir.vendor=vendor 5 | dir.vendor.bin=vendor/bin 6 | dir.build=build 7 | dir.build.phar=build/phar 8 | 9 | app.name=AF's PHP Benchmark tool :) (idc@inbox.ru) version 1.0.0 10 | app.description=This tool allows to quickly measure the server performance\nespecially the php performance on the server. 11 | app.version=1.0.0 12 | 13 | server1.name=S1 14 | server2.name=S2 15 | 16 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /build/phpbm.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florinsky/af-php-bench/d20c52477772f9e8918b9b9aebcb429ce99f5de0/build/phpbm.phar -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "af/phpbm", 3 | "description": "A simple tool to quickly measure server performance.", 4 | "license": "MIT", 5 | "authors": [ 6 | { 7 | "name": "Alexey Florinsky", 8 | "email": "af@simbirsoft.com" 9 | } 10 | ], 11 | "support": { 12 | "issues": "https://github.com/florinsky/af-php-bench/issues" 13 | }, 14 | "require": { 15 | "php": ">=5.3.3" 16 | }, 17 | "require-dev": { 18 | "phploc/phploc": "*", 19 | "kherge/box": "~2.5", 20 | "phpdocumentor/phpdocumentor": "*", 21 | "sebastian/phpcpd": "*", 22 | "phpmd/phpmd": "*", 23 | "pdepend/pdepend": "*", 24 | "phpunit/phpunit": "*", 25 | "phpunit/php-code-coverage": "*", 26 | "sebastian/environment": "*", 27 | "sebastian/phpdcd": "*", 28 | "phing/phing": "2.*" 29 | }, 30 | "autoload": { 31 | "classmap": [ 32 | "src/" 33 | ] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phpbm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | name; 13 | } 14 | 15 | function getVersion() { 16 | return $this->version; 17 | } 18 | 19 | function getDescription() { 20 | return $this->description; 21 | } 22 | 23 | function addTestGroup($name, $tests) { 24 | $this->groups[] = new BenchmarkTestGroup($name, $tests); 25 | } 26 | 27 | function run() { 28 | $time = 0; 29 | $pb = new BenchmarkProgressBar(); 30 | $pb->setTestCount($this->getTestCount()); 31 | foreach($this->groups as $g) { 32 | $time += $g->run($pb); 33 | } 34 | $pb->theEnd($time); 35 | } 36 | 37 | function getTestCount() { 38 | $cnt = 0; 39 | foreach($this->groups as $g) { 40 | $cnt += $g->getTestCount(); 41 | } 42 | return $cnt; 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/base/BenchmarkBase.php: -------------------------------------------------------------------------------- 1 | skip=true; 13 | } 14 | } 15 | 16 | function run() { 17 | $this->start(); 18 | $this->skip or $this->test(); 19 | $this->stop(); 20 | return $this->_stop_time - $this->_start_time; 21 | } 22 | 23 | protected function start() { 24 | $this->_start_time=microtime(true); 25 | } 26 | 27 | abstract protected function setUp(); 28 | abstract protected function test(); 29 | abstract protected function down(); 30 | abstract function getName(); 31 | 32 | protected function stop() { 33 | $this->_stop_time=microtime(true); 34 | } 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/base/BenchmarkProgressBar.php: -------------------------------------------------------------------------------- 1 | test_count = $cnt; 12 | } 13 | 14 | function groupBegin($group_name) { 15 | $group = $this->formatGroup($group_name); 16 | echo "$group\n"; 17 | } 18 | 19 | function groupEnd($group_name, $total_time) { 20 | $time = $this->formatTime($total_time); 21 | echo "Time: $time\n\n"; 22 | } 23 | 24 | function testCompleted($group_name, $test_name, $time) { 25 | $group = $this->formatGroup($group_name); 26 | $time = $this->formatTime($time); 27 | $number = $this->formatNumber($this->current_test_num, $this->test_count); 28 | $name = $this->formatName($test_name); 29 | echo $this->formatText($number, $name, $group, $time); 30 | $this->current_test_num++; 31 | } 32 | 33 | function theEnd($time) { 34 | echo "TOTAL TIME: ".$this->formatTime($time) . "\n\n"; 35 | } 36 | 37 | function formatNumber($current_number, $total_number) { 38 | $number_padding = 7; 39 | if ($total_number < 10) $number_padding=0; 40 | elseif ($total_number < 100) $number_padding=5; 41 | return str_pad($current_number . '/' . $total_number, $number_padding, ' ', STR_PAD_LEFT); 42 | } 43 | 44 | function formatGroup($group) { 45 | return '['.$group.']'; 46 | } 47 | 48 | function formatTime($time) { 49 | return str_pad(' '.number_format($time,2), 8, '.', STR_PAD_LEFT); 50 | } 51 | 52 | function formatName($name) { 53 | return $name; 54 | } 55 | 56 | function formatText($number, $name, $group, $time) { 57 | $text = ''; 58 | $space_len = 40; 59 | $name = "$number $name "; 60 | $space = str_repeat('.', $space_len-strlen($name)+strlen($time)); 61 | $text .= "$name $space{$time}s\n"; 62 | return $text; 63 | } 64 | 65 | } 66 | 67 | -------------------------------------------------------------------------------- /src/base/BenchmarkSuite.php: -------------------------------------------------------------------------------- 1 | _tests=$tests; 12 | $this->name=$name; 13 | } 14 | 15 | function run() { 16 | $this->_result=[]; 17 | $index=1; 18 | $test_number = count($this->_tests); 19 | foreach($this->_tests as $test) { 20 | $percent = round(($index-1) * 100 / $test_number); 21 | echo "$percent% ... "; 22 | $skipped=$test->skip ? '[skipped] ' : ''; 23 | $test_name = '#'.$index.' '.$skipped.$test->getName(); 24 | $this->_result[$test_name] = $test->run(); 25 | $index++; 26 | } 27 | echo "100%"; 28 | echo "\n"; 29 | } 30 | 31 | function __toString() { 32 | $text = ''; 33 | $labels = array_keys($this->_result); 34 | $longest = array_reduce($labels, function ($len, $item) { 35 | if(strlen($item)>$len) return strlen($item); 36 | else return $len; 37 | }, 0 ); 38 | $space_len = $longest+10; 39 | $text .= $this->name . "\n"; 40 | foreach($this->_result as $test_name=>$time) { 41 | $time = str_pad(' '.number_format($time,2), 8, '.', STR_PAD_LEFT); 42 | $space = str_repeat('.', $space_len-strlen($test_name)+strlen($time)); 43 | $text .= "$test_name: $space{$time}s\n"; 44 | } 45 | return $text; 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/base/BenchmarkTestGroup.php: -------------------------------------------------------------------------------- 1 | name=$name; 11 | $this->tests=$tests; 12 | } 13 | 14 | function getName() { 15 | return $this->name; 16 | } 17 | 18 | function run($progress_bar) { 19 | $total_time = 0; 20 | $progress_bar->groupBegin($this->name); 21 | foreach($this->tests as $t) { 22 | $test_time = $t->run(); 23 | $total_time += $test_time; 24 | $progress_bar->testCompleted($this->name, $t->getName(), $test_time); 25 | } 26 | $progress_bar->groupEnd($this->name, $total_time); 27 | return $total_time; 28 | } 29 | 30 | function getTestCount() { 31 | return count($this->tests); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/benchmark/BenchmarkArraySortIntegers.php: -------------------------------------------------------------------------------- 1 | data; 15 | $bb = microtime(true); 16 | 17 | $limit = 50000 * MULT; 18 | for($i=0;$i<$limit;$i++) { 19 | $b=$data; asort($b); 20 | $b=$data; ksort($b); 21 | $b=$data; sort($b); 22 | } 23 | } 24 | 25 | function getName() { 26 | return 'Array Sort (Integer Keys and Values)'; 27 | } 28 | 29 | protected $data=[ 30 | 18849627 => 45715, 31 | 79549708 => 68075, 32 | 15104254 => 194353, 33 | 52939704 => 605817, 34 | 81053625 => 8568810, 35 | 17073021 => 3352470, 36 | 84675569 => 11884360, 37 | 68597489 => 105832668, 38 | 33849442 => 688856, 39 | 5794138 => 311474, 40 | 79549708 => 626075, 41 | 1504254 => 1932464353, 42 | 529704 => 60737, 43 | 813625 => 8350810, 44 | 173021 => 35345470, 45 | 845569 => 11480, 46 | 6897489 => 107668, 47 | 339442 => 683256, 48 | 574138 => 3117474, 49 | 759708 => 68865, 50 | 11254 => 193643, 51 | 529704 => 607317, 52 | 8103625 => 850810, 53 | 17021 => 334450, 54 | 845569 => 11480, 55 | 6897489 => 107668, 56 | 339442 => 683256, 57 | 57138 => 3117274, 58 | 79708 => 688605, 59 | 15254 => 1936453, 60 | 523704 => 607317, 61 | 815625 => 8504810, 62 | 1707321 => 3345470, 63 | 8467569 => 114860, 64 | 6859789 => 1078668, 65 | 3384442 => 683856, 66 | 579438 => 311774, 67 | 795908 => 688675, 68 | 1514254 => 193353, 69 | 5299704 => 60717, 70 | 8153625 => 850823410, 71 | 1773021 => 334470, 72 | 8475569 => 11460, 73 | 6897489 => 107668, 74 | 3349442 => 683856, 75 | 574138 => 311774, 76 | 7949708 => 68875, 77 | 1504254 => 193353, 78 | 5239704 => 60717, 79 | 81053625 => 858234810, 80 | 1773021 => 334470, 81 | 8475569 => 11460, 82 | 6897489 => 107668, 83 | 3349442 => 683856, 84 | 574138 => 311774, 85 | 7949708 => 688075, 86 | 1504254 => 1934234353, 87 | 52939704 => 60817, 88 | 803625 => 850410, 89 | 103021 => 334470, 90 | 8675569 => 11460, 91 | 657489 => 107568, 92 | 389442 => 683256, 93 | 5794138 => 311234474, 94 | 7549708 => 68875, 95 | 1104254 => 193353, 96 | 52939704 => 60817, 97 | 81053625 => 858810, 98 | 17073021 => 335470, 99 | 84675569 => 11860, 100 | 68597489 => 1058668, 101 | 33849442 => 688856, 102 | 5794138 => 311474, 103 | 79549708 => 68075, 104 | 104254 => 193653, 105 | 59704 => 6073817, 106 | 81053625 => 8548810, 107 | 13021 => 3344570, 108 | 875569 => 114860, 109 | 697489 => 1075668, 110 | 3849442 => 6838856, 111 | 594138 => 3117474, 112 | 749708 => 688675, 113 | 104254 => 1936353, 114 | 59704 => 6073817, 115 | 8625 => 8504880, 116 | 103021 => 3344470, 117 | 8465569 => 114860, 118 | 6857489 => 1078668, 119 | 3389442 => 6838856, 120 | 5794138 => 3112474, 121 | 795708 => 688675, 122 | 15104254 => 1964353, 123 | 5299704 => 607817, 124 | 8103625 => 85048810, 125 | 1703021 => 3345470, 126 | 8465569 => 114860, 127 | 6857489 => 1078668, 128 | 3389442 => 6838856, 129 | 579138 => 3117474, 130 | 7959708 => 688075, 131 | 1514254 => 1934353, 132 | 529704 => 6073817, 133 | 81053625 => 8548810, 134 | 1703021 => 3345470, 135 | 8475569 => 114860, 136 | 6897489 => 1078668, 137 | 3349442 => 68328856, 138 | 57918 => 3117274, 139 | 7954908 => 688075, 140 | 1510254 => 1934353, 141 | 5293704 => 607817, 142 | 810325 => 8504810, 143 | 1773021 => 33445470, 144 | 84675569 => 1148860, 145 | 687489 => 1075668, 146 | 3384442 => 68328856, 147 | 5794138 => 3112474, 148 | 7954708 => 6886075, 149 | 15104254 => 1964353, 150 | 5239704 => 6073817, 151 | 81053625 => 8548810, 152 | 17073021 => 33445470, 153 | 8475569 => 1148860, 154 | 68597489 => 1058668, 155 | 3384442 => 68328856, 156 | 5794138 => 3112474, 157 | 7954978 => 688075, 158 | 15104254 => 19364353, 159 | 5293974 => 607817, 160 | 81053625 => 85048810, 161 | 1703021 => 3345470, 162 | 84675569 => 1148860, 163 | 6897489 => 1078668, 164 | 33849442 => 68328856, 165 | 5794138 => 3112474, 166 | 7959708 => 688075, 167 | 1510254 => 1934353, 168 | 5299704 => 607817, 169 | 8153625 => 8508810, 170 | 1703021 => 3345470, 171 | 8465569 => 1148860, 172 | 6859489 => 1078668, 173 | 3349442 => 6838856, 174 | 574138 => 3117474, 175 | 7959708 => 688075, 176 | 1510254 => 1934353, 177 | 5293904 => 607817, 178 | 81053625 => 8548810, 179 | 1707021 => 3345470, 180 | 8465569 => 114860, 181 | 68597489 => 10758668, 182 | 3349442 => 68328856, 183 | 5794138 => 31172474, 184 | ]; 185 | } 186 | 187 | -------------------------------------------------------------------------------- /src/benchmark/BenchmarkArraySortStrings.php: -------------------------------------------------------------------------------- 1 | data; 15 | $bb = microtime(true); 16 | 17 | $limit = 8000 * MULT; 18 | for($i=0;$i<$limit;$i++) { 19 | $b=$data; asort($b); 20 | $b=$data; ksort($b); 21 | $b=$data; sort($b); 22 | } 23 | } 24 | 25 | function getName() { 26 | return 'Array Sort (String Keys and Values)'; 27 | } 28 | 29 | protected $data=[ 30 | 'YXvXMGcuGok2wD2VQ' => 'kUh0KI', 31 | 'GYoH18' => 'xz3y8jkFc', 32 | 'Av6s8xSie' => 'u1WzWpZl0nDaNnb', 33 | 'VRg78Ya28flQvh' => 'WeVKE', 34 | 'gYN5hqxTn0j8ho44' => 'J1B5fwibXp', 35 | 'sBNEcmoRmWlKAbJBX5D7' => 'vVdT5b0iD', 36 | 'njG5DreuWXdd85 Vo5o' => ' SBd', 37 | 's5tn' => 'qKvBH', 38 | 'NU lgfQk4QIqr5renUa' => ' 7DnyClAj2x', 39 | 'FztORS0A6MA9BXqehaE' => 'grVzVM', 40 | 'KTtHknM 9g0npJ1u' => 'xuACm9M5qc', 41 | 'TuHnNIy5l14it3EhVcz' => 'YQAgLn0ZmxnqQymo3Sww', 42 | '6pnIBVvq' => 'vHxK6pk4VFh F5y M8W', 43 | '0KHilWKM1KYkWq9np' => 'sMUSM', 44 | 'i1a4IIBJ' => 'v3NLBWGAo16o', 45 | 'za8FrBrO0l5semeNp' => 'rqa4BMDu4vwwl', 46 | 'xu6bI9lJ' => 'Oqkjr', 47 | 'c58v61wYviRUpV4S60' => 'sJvZSXfXYZ', 48 | 'RKkEpuclIHac' => 'Z7s71dxiqH', 49 | 'Xk1 3sCQtJ7h2' => 'n59Y9vi', 50 | 'GrN6n16tmQdfmiD9CV' => 'SLDMjlN4itq UtN', 51 | 'ZCCD99Ojb7UxWx' => '8oR', 52 | 'cUmg2Sg1jzC1Iyb' => 'ecugUw9r', 53 | 'syZmGpMbC0h' => 'hrg', 54 | 'VraYAVNIN8XU' => 'Chl5YFsLxBvz4nD7TrD', 55 | 'cju864G2bbM6V6C' => 'XLt1SAo', 56 | '1YaAULutq' => 'q7yBIW', 57 | 'Dn5' => '748M9Ign6V', 58 | 'F4BzHI' => 'N0m5trmDy', 59 | '7Ub2VzTRy28 AlFx15w' => 'sUFYcBJMj1YiC', 60 | '9pc' => 'NAQBQ3LqkB6jd', 61 | '713sXT' => 'HAH', 62 | ' JIotc2XIX75x8L02' => 'ge9', 63 | '6gRE' => 'f98e8YO', 64 | 'Mp7d' => 'AkCMobU n9wcw8RFWLL', 65 | 'M3bAYWk1mA' => '15aFMBzJedInsU93', 66 | 'KHTCR ' => 'gWpt3VLHhus0MFUO2Sjo', 67 | 'pqn7Hq' => 'fqZSWVCxkvw', 68 | 'Wzbh5ywJFg' => 'Kb4kzRjKLjfzB13 wg', 69 | 'AHx' => '6h489Wl1fDNA2d5Gy', 70 | '4nSUfSMWEkl20tr3q' => 'xl2', 71 | 'NCqRL5j6Zya7O' => 'QRw7JkIUd1Vd', 72 | '6ANSodXNti50R sXO1' => 'v23ue5LaWQCxx wLosx', 73 | 'vAJcqUTEDAA4az x7' => 'TmglURpMbswHino2U', 74 | 'FcYuK' => ' tQ0m', 75 | 'KqMwkWFxh' => 'TfBJ5KVv8lHTsWUdCof8', 76 | 'e9groN5W7Fy' => 'gLOwmp', 77 | 'F2F2xzu4AcL6nKpA63rn' => 'GW94aM5H64dMZuyMh', 78 | 'jRKi8RdbSiA46tc38G52' => 'DUVakNb7', 79 | 'coXifAHELkGdrCxmmse' => 'obR', 80 | '92wYg9VFuyNcDm2vFX' => 'Ge7eZhyScZrjQ', 81 | 'huokHUsKQ5zLSYm0srw' => 'uSQk9I', 82 | 'q9t6klrv3KGGhd' => 'eM5AU6SMiVgCIjzQhdSo', 83 | 'GjOE0ZpkUi' => 'WMBjBp', 84 | 'IJlxEb57F4QNxt5oF4V' => 'tz3aKT80su6r2ybv', 85 | ' ae4UJhKGvv' => '8uVd94eF1q28', 86 | '5KwdpSdZEoldv86NzAG' => 'e6b688M9ON', 87 | 'NS69Gmgu6bdkUhyQDEt' => 'R zW7dg5t7KIQNJtu9l', 88 | 'xAk' => 'GsW', 89 | 'OCivDA' => 'WNrvI pDQ2dS8gB9C', 90 | 'pVJQ' => '6h5e', 91 | 'pWmTlZ07ZiW39' => 'v69q3Xuwu2ZlMBKK', 92 | '8d5RQyD' => 'CB1Q5RIDE', 93 | 'mw5QiJ3aSDtsIwCmF' => 'XixeIpWnNf7hwxg6MvG5', 94 | 'opUQ7J9xx71Ad4' => 'mcTiFD', 95 | 'T2FET7lgF' => 'baUzwH5v', 96 | 'WK4cqaYTmdoM3 ' => 'bTdC112h', 97 | 'FEpsp' => '5TaI8at56S4r', 98 | 'JrCiBLB' => 'GEHMuh6bvmd', 99 | 'Ne7quC6FA9LlqbaBk9pL' => '1FFrX8Q5jnT', 100 | 'xTv3E8z' => 'MWSiIoaUaij', 101 | 'NKkjU' => 'u7 NkzzDk1WSz', 102 | '9KxU75' => 'gMBcWADBloM', 103 | 'iWdA' => 'KT5du7WrUOKBAg4k5', 104 | 'BcMzX4t' => 'qC2AxGr95p4bh', 105 | 'l dTgpOibZZoM' => 'w1CebnSNeDB8HCx5pS4Q', 106 | 'uF5g' => 'cHuuGi8klzFGwTkHR3g4', 107 | 'nbGLWMnv0cNBZLzR' => 'SJtrbyYRKgQwikQS', 108 | 'g9R5xC0whQ1E V UB' => 'uMU', 109 | 'D9tCtd9RtjEGL1' => 'K3mhN7', 110 | 'a6690w' => 'HYgBMKJqMay9LJI', 111 | '7RExIhf0El5Wo6' => '1FmXcj', 112 | 'v9DA6cl' => ' ufXQwUYqg25N O', 113 | '1nsxJSCyAtDcQNwmOs' => 'gz56z3MjRJqAFnU5ijZ', 114 | '5DJ08A' => 'vfsdWV4b5Joua4uJZXZv', 115 | 'GO1dcFgaqgGfE5' => 'uIu EguLuhCRN 6', 116 | 'GUl6rJpcM' => '0q53U G1 ', 117 | 'ry9la' => 'UqX5cocEemdk', 118 | 'wRUwZVMZgFAbGEcO' => '1E1cpkSXHD59UG0sv', 119 | 'J8M' => 'kc5C p', 120 | 'K0JzOtZ0C8Yt15OWTt1' => 'LIbq9NGEHKmSM', 121 | 'KRhgD' => 'kh1w15XANxrDuQCr', 122 | 'kRL09' => 'Juyazx1t', 123 | 'e5D4DwxfcbKZ' => 'xX6EtJSwehooEAZcX', 124 | 'nmXd8EFk380zJaOGL4na' => 'QEeCwWqb90MbWqz VX2', 125 | 'WpdI96F1a4JU' => 'IsAfaOjdCR', 126 | 'R4UpbFH2J9TN3jCl' => 's5Sr', 127 | '6aZNXU' => 'tWL8j0x', 128 | 'BlXTIhS9MBewCDyN' => 'nlp55m9vg6', 129 | 'jgx3n1Wpe9iK' => 'lLpH53oaesk8Hp', 130 | '6r3usk0B' => 'ALr', 131 | '81quGlOCe8' => 'yhww5kcLgj7Xb5lnc0', 132 | 'J6sMw77LS9' => 'xr0vy4DQNMT5d DQ', 133 | '3nLTzyvxq' => 'pSf6Lz5l', 134 | 'KNOSWQiUm' => 'oIEDFi1YWpHMzl', 135 | 'h z' => 'lH43', 136 | 'bc6SrzojyGU' => 'IRcgUw wj gkacv', 137 | 'hgSVRnt5NhLK2CZTuO2L' => '21w1thomRi5KThvqa', 138 | 'NXKXvc99AMLdRBuVXlO5' => 'vMjpvmXbHWtjd', 139 | 'CVEEesxa2 nAS' => 'gioF3xJgUgVQN', 140 | 'T0flFIYTe 640az' => '2DF iZz2Hey', 141 | 'ZO9tIjgv' => '69q6345ljvwJ8q2nzNtc', 142 | 'vOVx4bEiUSwYS8Cb1' => 'RkMaiMpEt3VQB8g', 143 | 'suTKgcs' => 'wIkFowa', 144 | 'jeqxOp24qAaBnE6' => '5DZ23Uu4SaW5zM', 145 | 'EOx2VSHW' => 'oIpEatk6V5I', 146 | 'v4v2lLWWFO ' => 'o10TDAuBh', 147 | 'kXxvQ7 ' => 'mctMkg', 148 | 'BNpZHDFDXjr8a' => 'pC5B4dtOfdjFx9I', 149 | 'DAdH59gWXUYCB' => 'dLElWnQDkBOnfovwH5Z9', 150 | 'c7OLQDX9jZgq0' => 'SvLqCSL8J9', 151 | 'IGkgTMFD' => 'm9u57avlzxRKH', 152 | 'Og45l5FZn' => 'GT1njb', 153 | 'VxtSfb1mYl9Z2vdyg4d2' => 'NfYc3XJr4NG', 154 | 'KoAp92' => 'oLs0lDrmmzd3wXDbv', 155 | 'iQ6' => 'ruTkCMpmRsh2dnbxO', 156 | 'GrBYRke7hlcoqnfTF' => 'bUk8qmKdOlFV9gGT5', 157 | 'K8oquW' => 'i2nUA', 158 | 'upvelI' => 'QR0ql8gOCiqctockV', 159 | 'aZ4w4riempj' => '05M956', 160 | '3NA UIr3igWTD7SCODB' => '8LriKY4JzK5kXtlh1g', 161 | '8WCR' => 'WeDsFjoEqkGO3EClakcO', 162 | 'EwyJuej' => 'Vki5Umj6DU7UvJ', 163 | '4sMkZu0NT Kcy' => 'CJmJ3eZsfbL9zDxei', 164 | 'x3nI0v' => 'Fcd7AtWkWje', 165 | 'GxMwoUxYebKf' => 'BGWG 8hcjoIdT8J', 166 | ' fZz SZNOiMl6q3FG' => 'hGdQ0WRJ', 167 | 'lHZ0YNA H6AmNRl4' => 'kMe1tdWcYZO', 168 | 'jDQ4 nR' => 'LRnU OAC9xwptr0', 169 | 'zZX 5' => 'fy1B0LeD', 170 | '3y5FyHqGBcBL' => 'UKCwfewocs', 171 | 'k7j 0JX' => 'Lmm6uQCIMjFl6vU8T', 172 | '0Juf9sllso5K9Ukb' => 'sOleRbTUs0AgVj', 173 | 'xaAaFT' => '2Mv5UtOuNy5', 174 | 'oWfMkDJ5Mx19Bom8Nq' => 'CIIkS10VCt', 175 | 'Qj9Y9phHI9w' => '7YUx5Acw0uOlV', 176 | 'pkkhYVQ5snIStC' => 'ypbI4NnzeQa', 177 | 'hZM2T' => 'wLT5ff55wnNF2KUhRT7', 178 | '70vhiRY4msLAuArvY90' => 'vYsjWqQwTc0DzxM', 179 | '5AzzUiJ1CO' => 'gIp8i1', 180 | 'xzhJc1' => 'zbbG', 181 | 'ODRu2' => 'gFuKnsql', 182 | '8aslTFnc6g' => 'hVK3NVnsHg', 183 | '7LBNh8UbbYBB' => 'dggTpZqveOgMnTey2F', 184 | 'BfN' => 'kAfRu6h8kAlKF5O8YT', 185 | 'A KWt5' => 'taa', 186 | 'lSgQexcfsDHZxstog' => 'JmkUkBOLN4iqYsS5', 187 | 'EhrISFW76Jqe9MI' => '8XCVabalS', 188 | '1IKJSz8D' => 'AiDb', 189 | 'snr' => 'p1TyclY', 190 | 'D0OqaGKtbdbxOA' => '60o8fD SY1yIlfAO', 191 | 'QVONgFKT1p75VHCF1' => 'LbSzezmOSBf', 192 | 'AY4gniLl' => 'BxGa7c1XkzxCOGV', 193 | 'enVNG' => 'oxMbN3k4V2jfoiF95I', 194 | '8ztF5k5' => 'Kx8BWdQ2', 195 | 'se234euqlH9OZfJIzxYX' => '9aa58MpvTiGG9EEq5Ekx', 196 | '0KUUCeehCql' => 'atKrgpBvOazzLx8cXd', 197 | 'WeCkFVgOpg0 EeIRs' => 'h5UE7wxf9BMgShden2G', 198 | 'GO2TKvGC77WpCk' => 'Wh UlBWmpHBjyX', 199 | 'NoGCJQ6n92zA 25Bx1' => 'rqzDmWhrBzRXqH', 200 | 'CARWL' => 'zo9a F9xQTnQ', 201 | '6Lbo4eAADZoYqRgWnMI' => 'UtEzw2UGgoCo', 202 | '7s19UsXlmkl9QGclm35S' => 'jEg6pZeHV ', 203 | '41VVuuIXs8ZHFO' => ' YMWt8 a3oM51v5ZgJ', 204 | '11p' => 'cQROioT0osJTcH', 205 | 'GCUmZCMvq yr1' => 'jZd5qrJpBUs8Z4apS8H', 206 | 'vpMuXM' => 'VO8E', 207 | 'nK5' => '2bCEuLZRNM', 208 | 'kNmnrCole5d5Hhp' => 'V7x INDsOvJvrXr', 209 | 'jWGfqIm' => 'YYY', 210 | '4LtSMnWEu' => 'O5b', 211 | 'dAexYgKxSKu4' => 'IREoAxj6yVnTHmmVI8', 212 | 'j l4h9hHJzFFtoyjFQ' => 'XX 5uYaEdt', 213 | 'isZslBfbv0Y' => 'RMtG9BrvpRceYqcksQG', 214 | 'HyY3M6gu56' => 'ZBi', 215 | 'TKp9' => 'Uz0nxxRVJh AaBaeFDp', 216 | 'Aj6uxqUulHe' => ' qszc16tr5XcROnoxC', 217 | 'MME3tDFkNdhFd' => '2RRHWGJ', 218 | 'oy77SrdwB' => 'Kl4', 219 | 'NZemUd0 X1CtDwNsn2' => 'zK2ve4qrB', 220 | '7E4nRs' => 'Lduxu', 221 | 'nGYy6t8sbUoJIq' => 'LB7MkLoJudCbv3Ww', 222 | 'iHvwIaz' => 'wA4KA', 223 | 'VuRcsbSqWMR1iA' => 'oHQ1eZVc', 224 | 'UvjTo5gJJKtqlRwG' => 'FSQwOCUh', 225 | 'IY0uQHZ5z' => 'fDx0xm X9qosV', 226 | 'H5Qfc55uzVjJaB' => 'VdVoFFZ F', 227 | '9FygkN7OiloMOgrnAKYu' => 'svJm8', 228 | '275O5S5i' => 'VeWUhTWq2Dmsztn', 229 | 'cJjJHDV5AmE' => 'a5V5YrT5By6XTzK7nln', 230 | ]; 231 | } 232 | 233 | -------------------------------------------------------------------------------- /src/benchmark/BenchmarkCycles.php: -------------------------------------------------------------------------------- 1 | book; 18 | } 19 | } 20 | } 21 | 22 | function getName() { 23 | return 'Long Strings'; 24 | } 25 | 26 | protected $book=<<book)); 15 | } 16 | 17 | function getName() { 18 | return 'Explode/Implode'; 19 | } 20 | 21 | protected $book=<<book); 16 | $b = \crypt($this->book, 'asdasdaa'); 17 | $c = \md5($this->book); 18 | $d = \sha1($this->book); 19 | } 20 | } 21 | 22 | function getName() { 23 | return 'String Hash'; 24 | } 25 | 26 | protected $book=<<getName() . "\n"; 9 | echo "\n"; 10 | 11 | $app->addTestGroup('GENERAL', [ 12 | new AF\Benchmark\BenchmarkCycles(['skip'=>false]), 13 | new AF\Benchmark\BenchmarkRand(['skip'=>false]), 14 | new AF\Benchmark\BenchmarkObjects(['skip'=>false]), 15 | ]); 16 | 17 | $app->addTestGroup('STRINGS', [ 18 | new AF\Benchmark\BenchmarkStrSimple(['skip'=>false]), 19 | new AF\Benchmark\BenchmarkStrExImplode(['skip'=>false]), 20 | new AF\Benchmark\BenchmarkLongStrings(['skip'=>false]), 21 | new AF\Benchmark\BenchmarkStrHash(['skip'=>false]), 22 | ]); 23 | 24 | $app->addTestGroup('ARRAYS', [ 25 | new AF\Benchmark\BenchmarkFillArray(['skip'=>false]), 26 | new AF\Benchmark\BenchmarkArraySortIntegers(['skip'=>false]), 27 | new AF\Benchmark\BenchmarkArraySortStrings(['skip'=>false]), 28 | ]); 29 | 30 | $app->run(); 31 | 32 | 33 | 34 | --------------------------------------------------------------------------------