Posts Tagged optimisation

Logging page rendering time in Symfony 1.xx

Change your SF_APP/web/index.php file to be:

$timer = sfTimerManager::getTimer('myTimer');
sfContext::getInstance()->getController()->dispatch();
$timer->addTime();
$elapsedTime = $timer->getElapsedTime();
$fullRealUri = str_replace( sfContext::getInstance()->getRequest()->getUriPrefix(), "", sfContext::getInstance()->getRequest()->getUri());
file_put_contents('/tmp/time.log',date('Y-m-d H:i:s')."|$fullRealUri|$elapsedTime\n\r",FILE_APPEND);

Tags: , , ,

Online CSS and JS compressor – save your visitor time

Today I needed to reduce size of CSS and JS which was almost 400Kb all together. Spending some time found usefull tools for it.

http://iceyboard.no-ip.org/projects/css_compressor and http://dojotoolkit.org/docs/shrinksafe are winners

Before compressing javascript file make sure that You don’t have anything compressed already there, all lines are ending with semicolon and all code is valid.

After compression I saved 80Kb.

Finally we have changed CDN from amazon S3 to cachefly, and it is much quicker and they support gzip on-fly

Tags: , , ,