Tuesday, July 27, 2010

Optimize the performance of curl by using usleep() during the curl polling.
this will give the performance boost to your application

$CommonHandle = curl_multi_init();
for ($i = 1, $total = $activeCount; $i <= $total; $i++)
{
$Handle = curl_init();

curl_setopt($Handle, CURLOPT_URL, $Url);
curl_setopt($Handle, CURLOPT_HEADER, 0);
curl_multi_add_handle($CommonHandle, $Handle);
}

// Keep polling after an interval.
$isFinished = null;
do
{
curl_multi_exec($CommonHandle, $isFinished);
usleep(2000000); //wait for 2 seconds time in micro seconds
}
while ($isFinished > 0);
// To remove individual handles also from $CommonHandle.
curl_multi_close($CommonHandle);
If the particular font is not available on clients or end users machines then no need to load that font through the JS now we can include that font from css.
code:
@font-face {
font-family: 'ChunkFive Regular';
src: url('fonts/Chunkfive.eot');
src: local('ChunkFive Regular'), local('ChunkFive'), url('fonts/Chunkfive.woff')
format('woff'), url('fonts/Chunkfive.svg#ChunkFive') format('svg'),
url('fonts/Chunkfive.otf') format('opentype');

}