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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/ 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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-578366 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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-578371 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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-578392 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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-578457 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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-578696 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? Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-579150 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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-579202 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. Link to comment https://forums.phpfreaks.com/topic/112616-text-parsing-performance-question/#findComment-579212 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.