PHP Performance tool

Last week I started work on a little tool for my PHP programming. My scripts are (somewhat) OOP based, although I’m still learning all the nuances of that. Anyway, one day I was curious: when it comes time to begin improving the performance of the application, it makes sense that one should begin with the functions/class methods that are used the most. Well, how does one determine that? I suppose there are tools that exist to help one, indeed I know many do exist for C, C++ and Java languages, but PHP, I do not know.

Thus last Friday, April 11, 2003, I began work on a script that will eventually index an entire program, counting how often a function/method is called.

At the moment, all it does is index one script. It finds the beginning of a class definition, then searches for all the class methods. I need to test it on a file that contains multiple class definitions.

For the complete product, I envision it being called on the ‘main’ function of a program. Finding all the require[_once] and include[_once] statements, it traverses each file. During the traversal, it looks for class defitions, class methods and global functions, indexing each and counting how often each is referenced. Ideally, it would also be able to present a map of the entire program, showing what calls what. But that might be a bit much for now.

What it does find it displays in a nice HTML page. That should also be configurable for the final version: PDF, XHTML, XML, plain text should be good report options. Perhaps down the road I will implement some kind of caching capability, but now I’m too ahead of myself.

One thing for certain, this has taught me a lot about the preg functions, which I was rather weak with.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Comments are closed.