Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 01-10-2012, 09:12 AM   PM User | #1
Drachsi
New to the CF scene

 
Join Date: Feb 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Drachsi is an unknown quantity at this point
Thumbs up Combining JS to improve page download time

I am try to reduce the time taken to download my home page. I purchased a template and then just modified what I wanted. There is a script that calls 21 other scripts.

I am told if I combined all this scripts into one or two scripts, my download time would go down.

Help appreciated.

Drachsi
www.drachsi.com
Drachsi is offline   Reply With Quote
Old 01-10-2012, 09:40 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 13,421
Thanks: 152
Thanked 1,813 Times in 1,792 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by Drachsi View Post
I am try to reduce the time taken to download my home page. I purchased a template and then just modified what I wanted. There is a script that calls 21 other scripts.

I am told if I combined all this scripts into one or two scripts, my download time would go down.

www.drachsi.com
If the 21(!) scripts were combined the download time would not be materially reduced.

If the download time of your webpage is excessive I would look for some other cause. It loaded for me on broadband in a second or so.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 01-10-2012, 09:46 AM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 16,535
Thanks: 41
Thanked 2,714 Times in 2,689 Posts
Old Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of light
And is there a question in there?

The statement is probably true, but maybe not by as much as you might wish. It's not like combining them will make the total number of bytes smaller. You are only saving the HTTP request/response time needed for each one. But modern browsers can overlap those, thus minimizing the effects. (It's even possible that some browsers might be faster with multiple files than with one, though I admit that 21 seems excessive.)

Anyway, why not try it? It's just a matter of using an editor and hacking away.
__________________
"The world can bring you gifts, or poison in a jewelled cup."
-- Chen Liu, as quoted by his brother Chen Tai, in Under Heaven by Guy Gavriel Kay

Last edited by Old Pedant; 01-10-2012 at 09:49 AM..
Old Pedant is offline   Reply With Quote
Old 01-10-2012, 09:50 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 16,535
Thanks: 41
Thanked 2,714 Times in 2,689 Posts
Old Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of lightOld Pedant is a glorious beacon of light
Kind of funny that a website owner that offers to make a website audit for you would not know what is best on his own website. (Yes, I know...the website audit is of content, not coding. It's still a fun thing to contemplated. <grin/>)
__________________
"The world can bring you gifts, or poison in a jewelled cup."
-- Chen Liu, as quoted by his brother Chen Tai, in Under Heaven by Guy Gavriel Kay
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:35 AM.