0

If I have to load for example jquery.js file among some (let's tell about 10) other css / js files, what is a better approach?

"Using the google.load() method gives your application high speed and global access to a growing list of the most popular, open-source JavaScript libraries"

Rob W
  • 341,306
  • 83
  • 791
  • 678
Mr Sooul
  • 659
  • 2
  • 9
  • 19
  • 1
    Depends on where your audience are. If on an intranet an internally hosted version should load faster. – axk Jun 01 '11 at 10:29

3 Answers3

2

Use Google. There's a good chance this will already be cached on the client's computer since lots of people use it, so it may be faster.

Evgeny Shadchnev
  • 7,320
  • 4
  • 27
  • 30
  • still doesn't combat all the other issues relevant to web page performance. It's fine if you only have one or two js files. But if you have 10 js and 10 css files i would recommend another approach. – netbrain Jun 01 '11 at 10:56
2

Take a look here: Web Performance best Practices

Summarized:

ideally you should have all static content on subdomains like static1.example.org, static2.example.org. Which increases paralellity for downloads (increasing page load/render speed). in addition you should merge css files and js files, minify them and gzip them to reduce the number of roundtrips and the payload size. (mod_pagespeed is a apache module which can do this for you)

Also your content should be cached with a 1-year cache settings and version controlled (by naming convention, also available with mod_pagespeed)

netbrain
  • 9,194
  • 6
  • 42
  • 68
1

External servers, so called CDNs can be used to speed up the website, when e.g. they are located closer, or the file was used on another website and is already cached.

However, if your website is official, must be reliable, SaaS or whatever then using public CDNs is not advised. the option is then to buy commercial CDNs or host internally.

jakubmal
  • 222
  • 2
  • 8