HomePHP Using Timers to Benchmark PHP Applications
Using Timers to Benchmark PHP Applications
If you’ve been using PHP for a while, then it’s possible that you want to learn how to create benchmarking scripts. If this is true, then this series of tutorials will be pretty helpful. Welcome to the second article of the series “Benchmarking applications with PHP.” Composed of three parts, this series walks you through the development of several approaches aimed at benchmarking specific blocks of code and even entire PHP applications.
As you’ll surely recall from the last tutorial, I discussed distinct approaches for benchmarking concrete portions of code and even complete programs. These methods, which were originally created either as procedural solutions or object-based techniques, used the “microtime()” PHP built-in function to create simple timing functions along with a pair of useful timer classes.
Even though all the methods that I mentioned before are really simple to understand and follow rather basic logic, they’re also useful for creating more sophisticated timing solutions that eventually might fit the requirements of high-performance applications. I’m only going to provide you with some handy pointers on developing these kinds of timing mechanisms; what you do with them is obviously up to you.
Well, having refreshed the topics discussed in the first tutorial of the series, it’s time to go over the subject of this one. This way you will know what to expect from it before you start reading.
Since you already know how to create timer functions and classes, in this tutorial, I’ll create some concrete examples that show where these timing mechanisms can be applied in order to evaluate the performance of certain PHP applications.
Are you ready to learn more about how to benchmark applications with PHP? Let’s get started!