Jump to content

Text parsing performance question


zaroundus

Recommended Posts

I was wondering if anyone could tell me what the performance issues are with parsing multiple tabs and new lines in print statements. I have a developer that uses a ton of \t metacharacters when printing in PHP and I was wondering if there were any performance issues with this.

 

Example:

print "\t\t\t\t\t\tQuery Failed.<br />\n\t\t\t\t\t\t$newsSel_q<br />\n\t\t\t\t\t\t".mysql_error()."\n";

 

There are several lines like this in every page and it really drives me crazy but I don't want to force a code change unless there is some valid reason for it. Any input would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/
Share on other sites

I don't want to force a code change unless there is some valid reason for it.

 

How about on the grounds that it looks retarded?

 

Performance effects would be fairly minimal. The browser would be loading a larger file, so naturally there is some performance loss. As i say though, this is small. On the otherhand; I would find it a complete pain to work with that -- it's horrible on the eyes.

The developer in question wants his final outputted HTML to be properly indented. It doesn't matter to me at all and I know that whitespace in general can cause performance hits. It is very hard to look at but I wasn't sure if the aesthetics were the only thing wrong there. Maybe I'll do some script timing and see what the actual performance dip is.

Actually, it's done in order to make sure the source code is formatted properly. It is just a little OCD to add tabs to line up dynamically generated markup. Unfortunately, I did some script profiling (http://phpbuilder.com/columns/akent20000926.php3) and was unable to prove that the added tabs were causing a performance decrease.

I don't want to force a code change unless there is some valid reason for it.

 

How about on the grounds that it looks retarded?

 

Sorry for the useless post, but I had to lol. :\

 

Anyways, just use css. It's the obvious answer. Unless you're making a website that is known for its source code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.