[TYPO3-core] RFC #13998: Introduce Automatic versioning of CSS and JS files
    Jigal van Hemert 
    jigal at xs4all.nl
       
    Sun Apr  4 09:12:10 CEST 2010
    
    
  
Lars Houmark wrote:
> This is an SVN patch request (my first, be nice ;)).
Maybe we should be nice anyway?
$file = (TYPO3_MODE == 'BE' ? 
t3lib_div::createVersionNumberedFile($file) : $file);
I see this more and more in code (and I tend to use it myself also; lazy 
typist), but this morning I decided to run a benchmark:
$var = (1 == 0) ? 1 : $var;
versus
if (1 == 0) {
	$var = 1;
}
(and also for 1 == 1)
if the condition is true the ternary operator is not significantly 
slower than the if (about 5%), but if the condition is false then the 
ternary operator is 30-40% slower than the if (not surprisingly).
Using the if will make the FE slightly less slower when all the ternary 
operators with no functional else-part for this BE check are replaced 
with an if-statement.
It also makes code more readable and you are more likely to meet the 
insane 80-characters line length rule in CGL (the editing area on my 
screen is > 250 chars wide...)
Other than this:
+1 by reading (and for the idea to help the caching problems in BE)
-- 
Jigal van Hemert.
    
    
More information about the TYPO3-team-core
mailing list