I am calling a JS file with a <script src=...> tag in the header. It's a rather large file.

The thing is, there is one function in the file that needs a query parameter, and I therefore must pass it to the file, making the file not really cachable.

Should I split this function out into its own JS file? This would allow the majority of my JS code to be cached, but the downside would be the browser client would need to establish a connection with two separate JS files instead of just one.

Thinking about performance here.

Recommended Answers

All 3 Replies

Member Avatar for Dukane

In today's world of high-speed Internet connections, I don't think this would be a problem. I say go for it and see if the performance really changes considerably.

That won't make any difference. Plus by taking advantage of caching you are improving site performance overall which is a good thing.

Thanks for the feedback :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.