Hey all, I need to figure out a way to benchmark object methods and log them somehow. Maybe I have to create an object for this, I dunno. Perhaps I don't even need to do this, but am being dangerous somewhere in my coding.
I need your advice here.
I'm in the finalization stage of turning my hash() function algorithm enumerator (now PHL: the PHP Hash Library) into a fully object oriented library. The intent is for a modular object that you can use to give users the option to use alternate hashes for security during the install process. (Intelligently picking ones that are tough and fast on their server. Just use Hash() after install, not my objects.)
Only one problem:
Not long ago, and with my previous version even, I was getting speeds of roughly 130gb/sec throughput through the hash() function, but now it averages in the tens of MB/sec. I still get this old speed with the previous version. But now, after a number of supposedly trivial changes (ones I don't recall now) the page takes 5-7 times longer to load! This is from 0.8 seconds to roughly 5.3 seconds average. The previous version typically sits at 0.6-0.8 seconds, but the new hashes with each 3 times and used to hit 1 second generation time tops.
I cannot seem to pin down where the slowdown occurs, which is ticking me off. There are a good number of loops in my test page, but they're all lightweight. I suspect that somewhere inside my object(s) (there are 3) there may be a near infinite loop somewhere. Or I just have too many nested loops, though I find they're quite necessary.
What do you suggest? I have attached the source beta so that you can analyze it for yourself. I would have attached the log file(s) but I cannot find them; perhaps someone could help by telling me what to set in PHP.INI for a WAMP system. Any help is appreciated!
(Background colors won't make much sense so long as this issue persists I'm afraid. I had it just right, and was going to continue to tweak it.)
Addendum: Trying to shutdown Apache, it seems to be taking an inordinately long time. Almost 90 seconds, and I have an AMD X2 4800+. I'm looking into that, but I think it may return to this point if I'm doing something subtly wrong in my script. Restarting Apache yields no difference in page test speed, though Apache closes quickly again.
__________________ Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook