2

I'm trying to do some simple locally-hosted development using the Ext framework. The site is configured as a virtual directory under IIS 7, so that http://localhost/app points to the index file. The path works fine; the file loads.

Here's my problem: despite the fact that I am not making any changes to the very sizable Ext library javascript files (about 2.4 mb uncompressed), those files are being reloaded every single time I refresh the html file. Even though these files are being served off my local hard drive, each page refresh takes 12 to 13 seconds. This is making testing pretty, um, frustrating.

How can I get unchanged js files to cache? Failing that, why aren't they being loaded more quickly? I'm not downloading them off the internet, I'm moving 2 megs around on my hard drive, which I'm pretty sure should be trivial, time-wise.

Thanks!

2 Answers 2

2

I'd guess that your delay isn't browser-getting-file-from-localhost-server, it's browser-interpreting-2.4mb-of-javascript. That's a lot of code to parse, and it's going to take more time than simply reading the file off the disk. I'd expect that the browser won't cache a compiled version of the file anyways, so even pulling a cached version would require re-parsing the script.

Your best bet is to optimize the .js file and strip out any functions you don't actually use (or that aren't required by the functions you do use).

0

You need to put some caching directives in your script header or directly at the server level.

At the server level:

IIS7: How to set cache control for static content?

You must log in to answer this question.

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