[jQuery] Re: Drastically reducing jQuery load time

2007-11-05 Thread eferraiuolo

Just use the minified version and send it over the wire gzipped and be
done with it.

The eval of packed jQuery does take some time, so even if the file is
cached it probably will be slightly slower than the cached minified
variation.

Check this out:
http://www.julienlecomte.net/blog/index.php?s=jquerysbutt=Go

Eric

On Nov 4, 2:13 pm, S. Robert James [EMAIL PROTECTED] wrote:
 While working on a web app, I thought of this method to drastically
 reduce jQuery load time.

 Every link follow causes jQuery to be reloaded again. Now, although
 the .js file is stored in the local cache, it still needs to be parsed
 and executed, which takes a lot of time.  What if, instead, we use a
 FRAMESET, keeping jQuery in the master frame, and just changing a
 child frame (which takes up the entire screen).  This way, jQuery
 never needs to be reloaded.

 What does everyone say?



[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread Jeffrey Kretz

I would need to see some actual stats as to the performance hit of the
jQuery file loading itself into memory before I had this concern.

My personal experience, even with very slow computers, is that I haven't
seen a lag when loading a cached page with a cached jQuery file into memory.

I have no doubt that the solution you propose would improve performance, but
if it went from 0.032 seconds to 0.0012 seconds, I can't imagine that would
be worth using a frameset and the other hassles and problems it could cause.

If you are using the packed version of jquery which uses this sort of setup:

eval(function(p,a,c,k,e,r).

You could instead use the minified/gzipped method, which will reduce any
eval overhead (in additional to making a smaller download).

JK 

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of S. Robert James
Sent: Sunday, November 04, 2007 11:13 AM
To: jQuery (English)
Subject: [jQuery] Drastically reducing jQuery load time


While working on a web app, I thought of this method to drastically
reduce jQuery load time.

Every link follow causes jQuery to be reloaded again. Now, although
the .js file is stored in the local cache, it still needs to be parsed
and executed, which takes a lot of time.  What if, instead, we use a
FRAMESET, keeping jQuery in the master frame, and just changing a
child frame (which takes up the entire screen).  This way, jQuery
never needs to be reloaded.

What does everyone say?




[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread S. Robert James



On Nov 4, 3:04 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 I would need to see some actual stats as to the performance hit of the
 jQuery file loading itself into memory before I had this concern.


Is there a good way to profile page load, and determine how much time
is spent parsing/executing jQuery, how much is spent on CSS, how much
is spent on screen paint, etc.?  (This would have tremendous use
outside of this particular question...)



[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread Karl Swedberg

Hi Robert,

You can try the YSlow extension. It piggybacks off of the Firebug  
extension for Firefox:


http://developer.yahoo.com/yslow/


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Nov 4, 2007, at 3:37 PM, S. Robert James wrote:





On Nov 4, 3:04 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
I would need to see some actual stats as to the performance hit of  
the

jQuery file loading itself into memory before I had this concern.



Is there a good way to profile page load, and determine how much time
is spent parsing/executing jQuery, how much is spent on CSS, how much
is spent on screen paint, etc.?  (This would have tremendous use
outside of this particular question...)





[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread Sean Catchpole

Hi Robert,

I doubt the load time of jQuery is very significant. Downloading files
take much much longer than it does to execute. Regardless, I
personally would not use frames since then the url will never change.

~Sean


[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread Jeffrey Kretz

I just tried looking through the various parts of Firebug, and while it
profiles net traffic excellently, I don't see anyway to profile memory/CPU
time on the different elements.

I did test a script which captures the date/time, then loads the jQuery
file, then captures the date/time again and calculates the millisecond
difference between them.

You can see this (using uncompressed jQuery):
http://www.scorpiontechnology.com/Cobalt/speedtest.htm

After clearing the cache and visiting the page (reflushing the cache each
time), I got these results:

1078ms
1109ms
1078ms
1078ms

Subsequence hits to the page (using the retry link) were: 

16ms
15ms
0ms
16ms

I then made another page that uses the packed version of jQuery which has to
be eval'ed on load.

http://www.scorpiontechnology.com/Cobalt/speedtest2.htm

Initial load test:

641ms
656ms
656ms
640ms

Subsequent visits using the retry button (with cached files):

47ms
32ms
46ms
47ms

So there is definitely some overhead evaling the packed version of the
script, on the order of magnitude of about 0.03 seconds. 

Then, for poops and giggles, I tried the same thing with a minified gzip
jQuery:

http://www.scorpiontechnology.com/Cobalt/speedtest3.htm

Initial load test:

485ms
468ms
469ms
562ms

Subsequent cached loads were:

15ms
16ms
0ms
16ms

(identical to the initial uncompressed jQuery test).

I'd be curious to see if others get similar results, but for now, I would
say that using the minified/gzipped solution will result in the least amount
of network overhead (duh) without the (albeit minor) performance hit of the
packed version.

And on the original point about framesets, 0.016 seconds savings in time is
not worth the problems inherent in a frameset-based website IMHO.

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of S. Robert James
Sent: Sunday, November 04, 2007 12:37 PM
To: jQuery (English)
Subject: [jQuery] Re: Drastically reducing jQuery load time




On Nov 4, 3:04 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 I would need to see some actual stats as to the performance hit of the
 jQuery file loading itself into memory before I had this concern.


Is there a good way to profile page load, and determine how much time
is spent parsing/executing jQuery, how much is spent on CSS, how much
is spent on screen paint, etc.?  (This would have tremendous use
outside of this particular question...)




[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread Morgan Allen
Firebug even has its own code profiler built in (Profile button on the
Console tab), I have used it and YSlow, I think firebugs is better on its
own.

On 11/4/07, Karl Swedberg [EMAIL PROTECTED] wrote:

 Hi Robert,
 You can try the YSlow extension. It piggybacks off of the Firebug
 extension for Firefox:

 http://developer.yahoo.com/yslow/


 --Karl
 _
 Karl Swedberg
 www.englishrules.com
 www.learningjquery.com



 On Nov 4, 2007, at 3:37 PM, S. Robert James wrote:




 On Nov 4, 3:04 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:

 I would need to see some actual stats as to the performance hit of the
 jQuery file loading itself into memory before I had this concern.


 Is there a good way to profile page load, and determine how much time
 is spent parsing/executing jQuery, how much is spent on CSS, how much
 is spent on screen paint, etc.?  (This would have tremendous use
 outside of this particular question...)





-- 
http://morglog.alleycatracing.com
Lets make up more accronyms!

http://www.alleycatracing.com
LTABOTIIOFR! ROFL! ROFL! ROFL!
Upcoming alley cats, reviews, touring logs, and a general congregation of
bike nerdity.


[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread S. Robert James

I benchmarked also, using a homebrew console.debug(new
Date().getTime()), and consistently got about 90ms to load jQuery,
plus another 100ms to load all the plugins and custom JS.  That's a
lot of time - in the sense of a browser based web app that is supposed
to be highly reactive.

One alternate idea to frames is to load jQuery at the end of the
page.  That way, the user can see the entire page while jQ loads in
the background,  See http://developer.yahoo.com/performance/rules.html#js_bottom
(thanks for the tip, Karl).

On Nov 4, 5:11 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 I just tried looking through the various parts of Firebug, and while it
 profiles net traffic excellently, I don't see anyway to profile memory/CPU
 time on the different elements.

 I did test a script which captures the date/time, then loads the jQuery
 file, then captures the date/time again and calculates the millisecond
 difference between them.

 You can see this (using uncompressed 
 jQuery):http://www.scorpiontechnology.com/Cobalt/speedtest.htm

 After clearing the cache and visiting the page (reflushing the cache each
 time), I got these results:

 1078ms
 1109ms
 1078ms
 1078ms

 Subsequence hits to the page (using the retry link) were:

 16ms
 15ms
 0ms
 16ms

 I then made another page that uses the packed version of jQuery which has to
 be eval'ed on load.

 http://www.scorpiontechnology.com/Cobalt/speedtest2.htm

 Initial load test:

 641ms
 656ms
 656ms
 640ms

 Subsequent visits using the retry button (with cached files):

 47ms
 32ms
 46ms
 47ms

 So there is definitely some overhead evaling the packed version of the
 script, on the order of magnitude of about 0.03 seconds.

 Then, for poops and giggles, I tried the same thing with a minified gzip
 jQuery:

 http://www.scorpiontechnology.com/Cobalt/speedtest3.htm

 Initial load test:

 485ms
 468ms
 469ms
 562ms

 Subsequent cached loads were:

 15ms
 16ms
 0ms
 16ms

 (identical to the initial uncompressed jQuery test).

 I'd be curious to see if others get similar results, but for now, I would
 say that using the minified/gzipped solution will result in the least amount
 of network overhead (duh) without the (albeit minor) performance hit of the
 packed version.

 And on the original point about framesets, 0.016 seconds savings in time is
 not worth the problems inherent in a frameset-based website IMHO.

 JK

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

 Behalf Of S. Robert James
 Sent: Sunday, November 04, 2007 12:37 PM
 To: jQuery (English)
 Subject: [jQuery] Re: Drastically reducing jQuery load time

 On Nov 4, 3:04 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
  I would need to see some actual stats as to the performance hit of the
  jQuery file loading itself into memory before I had this concern.

 Is there a good way to profile page load, and determine how much time
 is spent parsing/executing jQuery, how much is spent on CSS, how much
 is spent on screen paint, etc.?  (This would have tremendous use
 outside of this particular question...)



[jQuery] Re: Drastically reducing jQuery load time

2007-11-04 Thread Mika Tuupola



On Nov 5, 2007, at 12:11 AM, Jeffrey Kretz wrote:

of network overhead (duh) without the (albeit minor) performance  
hit of the

packed version.


The performance hit is bigger for clients which have slow  
refrigerator cpu (read iPhone).


--
Mika Tuupola
http://www.appelsiini.net/