Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Benchmarking Zend Framework with a plugin

I have created this plugin to benchmark the performance of my Zend Framework Project

http://pastebin.com/HD9MpRfR

One odd thing that happens is that sometimes the generated values are negative,

Unit: Microseconds 
Routing: 0.0013879999999999 
Dispatch : -0.477942 
Dispatch Loop: -0.470018 
Total : -0.430279 

Why is this?

like image 918
Yasser1984 Avatar asked Apr 28 '26 05:04

Yasser1984


1 Answers

Your code is calling microtime(). I think you need to call it like this: microtime(true). According to the PHP documentation:

If used and set to TRUE, microtime() will return a float instead
of a string, as described in the return values section below. 

So, you are substracting strings every time. It might lead to strange results.

Also, check the returned *Start and *End values, maybe there is some problem in the logic of your plugin (I didn't review it in detail). An alternative technique could be to store these values in Zend_Registry instead of member variables. Maybe your plugin is being called several times, for startup and shutdown (this would reset the values of the member variables).

Hope that helps,

like image 95
dinopmi Avatar answered May 03 '26 02:05

dinopmi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!