Reputation:
Trying to choose the right theme: I have a main javascript file with an amount of 500kb. In this file are many functions, which are not being used on the current site.
Beside the additional load on page load: Can these unused functions slow down the performance?
Can unused functions require RAM or CPU usage on visitors end, even if they are not used, for example because they're storing variables?
Upvotes: 3
Views: 1461
Reputation: 1075159
Beside the additional load on page load: Can these unused functions slow down the performance?
Beside the additional load on page load? Only if the user is on an extremely memory-starved device. 500k of JavaScript code doesn't translate into much memory usage for the parsed result at all, the effect of it sitting in memory will, in all but the most unusual environments, be effectively zero.
But two points on the thing you were leaving out with that "beside" comment:
But effectively, in the vast majority of environments, just having the extra functions around won't cause a noticeable effect at all. It's primarily downloading the unnecessary program text that will be noticeable.
Upvotes: 3
Reputation: 1491
Yes, because these functions are still being downloaded by the browser and stored in memory of the page in the browser.
But mind you, they probably won't have a big effect, so purging the javascript may not lead to a noticable increase, unless your users are visiting the site with a really slow internet connection or something.
Upvotes: 5