zaroundus Posted June 30, 2008 Share Posted June 30, 2008 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. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted June 30, 2008 Share Posted June 30, 2008 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. Quote Link to comment Share on other sites More sharing options...
effigy Posted June 30, 2008 Share Posted June 30, 2008 Why are they using them in the first place? If you need "pretty" looking errors, use CSS. Quote Link to comment Share on other sites More sharing options...
zaroundus Posted June 30, 2008 Author Share Posted June 30, 2008 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. Quote Link to comment Share on other sites More sharing options...
effigy Posted June 30, 2008 Share Posted June 30, 2008 This indentation may be spoiled if you change the font face or size. There should be a template of sorts that everyone can use. Quote Link to comment Share on other sites More sharing options...
zaroundus Posted June 30, 2008 Author Share Posted June 30, 2008 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. Quote Link to comment Share on other sites More sharing options...
effigy Posted July 1, 2008 Share Posted July 1, 2008 By source code, I assume you mean HTML? How important is this--are people actively reading it? You could use a module to build the output tree, perhaps. What happens when you change the GUI--all of the tabs must be updated throughout? Quote Link to comment Share on other sites More sharing options...
zaroundus Posted July 1, 2008 Author Share Posted July 1, 2008 I guess that's part of my concern. I have no idea how much extra time it takes to count the tabs necessary for the code to line up just so. It just seems like a waste of time, energy, and typing to me. Quote Link to comment Share on other sites More sharing options...
Jabop Posted July 1, 2008 Share Posted July 1, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.