-1

I am trying to improve how fast our corporate web pages load up/render. Part of the problem is a bunch of JavaScript files.

If I put the JavaScript files, including the JavaScript files they each reference, up on a very fast server, all on the same domain, will that get me a significant increase in speed (I ask rather than trying because trying will take a fair amount of time).

And if this can be a big win, do I need a highly optimized file server for these files? Or a dedicated IIS server? Or will a CDN do the job? (I know a CDN is great for having large files close for more efficient downloads, but are they also designed to deliver files quickly?)

Also, is the page load issue for JavaScript primarily downloading the file? Or processing it?

3
  • What is the -1 for? Some guidance would be appreciated. Apr 28, 2021 at 5:46
  • I guess it was because the question is broad and likely to be answered with opinions or generalities. My answer had to be pretty general. May 8, 2021 at 11:09
  • @AndrewSchulman The problem with being specific is then I may eliminate what is the easiest way to increase load speed. And with that said, I was pretty specific asking specifically about loading linked files. But... you may well be right. What I find a fair question someone else may decide is awful. That's why in all my time on SO I've only downvoted 2 questions, because who am I to apply my narrow view of what's valid. May 8, 2021 at 19:08

1 Answer 1

1

For your users, the wait time is the sum of the time it takes to

  1. Serve the files from your host,
  2. Transfer them across the network, and
  3. Interpret and run them on the client.

Your question focuses on #1, but that's probably not the slowest one. Networks are generally a few orders of magnitude slower than file systems, which are slower than CPUs.

So you can probably get the best performance improvement by focusing first on #2. Bundle and minify your Javascript files using tools like Webpack or Gulp.js, and compress them on the wire.

#3 isn't directly in your control, but you can improve it by reducing the number and size of Javascript files you ask the client to run.

Of course this is all generalities. To know for sure, you'll need to test.

1
  • Very good point on #2. But for #1, if there's latency on the server responding to the request, that could be significant too. Apr 27, 2021 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .