Kyle B.
Kyle B.

Reputation: 5787

Can a file based CacheDependency adversely affect performance?

I'm trying to make an architectural decision to ease development, and want to know if anyone could provide insight how much performance overhead is necessary to institute a file based CacheDepdency in .NET?

Currently, my design approach is to segment our Javascript-based functionality into separate files for each piece of logic for maintainability/readability reasons. At runtime, I am merging and gzip compressing all the files into a single include. Additionally, I am using a file based CacheDependency for each logic block and on subsequent requests I am rebuilding the cache when any of those files change.

Is there a significant performance impact for using this approach? If there are 30 files in the CacheDepdency, does this run significantly slower than say 2 or 3 files, or is this only milliseconds of difference?

Upvotes: 1

Views: 245

Answers (1)

Louis Ricci
Louis Ricci

Reputation: 21106

The difference would be negligible.

But the real question should be 'Why are you changing files on a deployed/released website?'.

In my opinion, it would make more sense to keep your scripts separated as you have them for DEVELOPMENT and when test/staging/release time comes around have a build script that 1) concatenates your JS files, 2) compresses them with some JavaScript compressor/optimizer -- for debugging purposes you can skip this step -- 3) serve the single static JS file and let your web server handle the GZip/caching.

Upvotes: 2

Related Questions