granthnk / hoverzoom

Automatically exported from code.google.com/p/hoverzoom
0 stars 0 forks source link

Change script load time from document_start to document_idle #194

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Loading most scripts at document_start seems like a huge overkill. Especially 
jquery.min.js, that gets loaded on EVERY page and slows EVERY page by 40--50 ms 
on my computer.

Is document_start really necessary? Everything still works in the same way if 
loaded at document_idle.

Original issue reported on code.google.com by tw33dl3....@gmail.com on 3 Jan 2012 at 6:50

GoogleCodeExporter commented 9 years ago
It would also make sense to concatenate all *_a.js files into a single blob to 
speedup their load since they are loaded on every page as well.

Original comment by tw33dl3....@gmail.com on 3 Jan 2012 at 6:53

GoogleCodeExporter commented 9 years ago
These are initialization scripts that need to be run before the main script, 
that's why I load them at document_start. I'll do some tests and see if it can 
be changed.
As for the *_a.js scripts, I don't think merging them would make a difference. 
It would if the scripts were on a web server and several HTTP requests were 
made, but here they are loaded from local files, which is very fast.

Original comment by romain.v...@gmail.com on 3 Jan 2012 at 6:58

GoogleCodeExporter commented 9 years ago
http://code.google.com/chrome/extensions/content_scripts.html says that scripts 
are injected in the order they are listed. It works for me if you remove all 
'run_at' lines and move hoverzoom.js to the end of the list.

Original comment by tw33dl3....@gmail.com on 3 Jan 2012 at 7:05

GoogleCodeExporter commented 9 years ago
Thanks for the info!

Original comment by romain.v...@gmail.com on 3 Jan 2012 at 8:24

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r378.

Original comment by romain.v...@gmail.com on 4 Jan 2012 at 4:45

GoogleCodeExporter commented 9 years ago
Thanks for fixing this!

Original comment by tw33dl3....@gmail.com on 4 Jan 2012 at 4:56