Re: slowness mystery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 4, 2008 at 8:45 AM, Rene Veerman <rene7705@xxxxxxxxx> wrote:
> Ok, i changed from reading from the database to reading from a file.
> It now clocks at 3.37seconds for the malignant peace of javascript..
> Still too slow :(
>
> Timing the readfile statement that outputs the cache file, is at 0.00109
> seconds according to a measurement done with microtime()
> It seems that this is not correct, because if i remove the readfile
> statement, things speed up to 120 milliseconds (from 3.37seconds)..
>
> Some more help would be greatly appreciated..
>
> On Wed, Jun 4, 2008 at 9:20 AM, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
>
>> On Wed, Jun 4, 2008 at 3:05 AM, Rene Veerman <rene7705@xxxxxxxxx> wrote:
>>
>>> Hi..
>>>
>>> I've built a cms that's running into a serious speedbump.
>>> I load several sets of javascript through a custom built db
>>> caching&compression system.
>>> Loading it without caching and compression takes between 2 and 3 seconds
>>> for
>>> the entire app, 112Kb javascript.
>>>
>>> The caching system first compresses/obfusicates the requested
>>> source-files,
>>> then gzcompress()es that and stores the result in my database.
>>>
>>> The next time the page is requested, the caching system detects the cached
>>> copy, and outputs that with an echo statement.
>>>
>>> One of these code bundles that i request takes over 6 full seconds to
>>> load.
>>> It's the same 122Kb obfusi-compressed to 52Kb.
>>> Even without obfusication, it takes 6 seconds to load when taken from the
>>> database.
>>> So it's not the browser being slow in parsing the obfusicated code.
>>> Firebug's "net"-tab shows this one snippet taking 6 seconds. I don't know
>>> exactly what that measures, just the transit time i hope..
>>>
>>> I suspected the database query, but retrieval takes less than a
>>> millisecond.
>>> So does the 'echo' statement that outputs it.
>>>
>>> I'm really puzzled as to what can cause such a delay.
>>>
>>
>> i think putting the js in the database at all, and then using php to
>> retrieve it is unnecessary overhead.  i would put the cached contents on
>> disc, and refer browsers to a direct url.  maybe you could just put the
>> contents of one of your compressed files on disc, and request it from the
>> browser, time that, and see if it gets you anywhere.
>>
>> also, i would check into some of the resources yahoo has in this dept.  for
>> example, the ySlow firebug plugin,
>>
>> http://developer.yahoo.com/yslow/
>> there are additional resources as well, and they even have a really slick
>> js compressor, freely available.  its so slick in fact, that it will reduce
>> the length of variable identifiers that are safe to do on because those
>> variables happen to be closures.  neat stuff.
>>
>> -nathan
>>
>

Maybe you can work out some mod_deflate/gz action with apache to
compress it for all browsers except IE?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux