Forum Moderators: coopster

Message Too Old, No Replies

Performance issue

lots of regexp

         

MrCrowley

8:48 pm on Apr 21, 2004 (gmt 0)

10+ Year Member



Hi,

I have programmed an admin interface and templating system to suit the needs I have. I am quite happy with it since it permits me to build a website quickly with a lot of features.

My concern is not it's flexibility but it's efficiency. I use a lot of regular expressions to find the modules, instructions and fields to plug inside a template. I have not yet encountered speed problems, but I wonder how much more functionnalities I will be able to add before I get a performance issue.

In my templating system, every template controls directly it's output. All the instructions are taken from the placeholders in the text of the template. I did it this way relying on the speed of web servers as I thought they could easily parse the templates.

To optimize, I tried to divide the code in chunks and including the chunks as I need them, but still there's always a lot of code to parse for each page, however simple it is.

Am I right to think that today's (and tommorrow's too) servers are fast and optimized enough to forget about performance tuning and concentrate on functionnalities? How could I benchmark my code?

I've heard of Zend studio's profiler, but I always had problems with Zend Studio Server. Something else exist?

Any advice on performance is appreciated!

ergophobe

9:56 pm on Apr 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I use xdebug - it's the only php profiler I've gotten running but, as even the developer admits, profiling is rather rudimentary and being entirely reworked for the next version. Still, it should tell you what you need.

As for Regex, it's funny you should say that. I'm doing a similar thing (template-based site that will allow online editing for site editors). All I can say is that, to avoid regex as much as possible, I try to do the regex replacements and text processing when the page is changed/uploaded so that I can use str_replace() and such as often as possible when the page is viewed.

Tom