Closed (fixed)
Project:
Date
Version:
6.x-2.0-beta4
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Aug 2008 at 16:59 UTC
Updated:
27 Feb 2009 at 22:05 UTC
I've noticed that there are a couple of places where parts of the Date module load CSS and JS files when they are not needed. This slows down page load times.
First, in date_popup/date_popup.module, the date_popup_init() function is used to load CSS files. The way it currently works, these files are always loaded for every page, whenever the module is active. If this code is moved into date_popup_load(), they are only loaded only when needed.
The loading of date_timezone.js is in a similar state. Couldn't it be moved into date_timezone_site_form() and date_timezone_user_form()?
Comments
Comment #1
karens commentedYou're right about the timezone js file and I have made that change. I disagree about the css file though. The recommendation is to load this in init so it can be packed with all the other css files. If you load it later, it actually requires special treatment that slows things down.
Comment #2
gribnif commentedI disagree with your disagreement :-). On my site, at any rate, the date module is hardly ever used--on perhaps 50 out of 10,000 pages. So, if the patch wasn't present, for the majority of pages I would end up sending these unneeded CSS files (aggregated) to the user.
I also don't think there is any real performance degradation in doing things according to my patch. All it means is that there are more possible combinations of files that can be present or missing which, in the end, just means a few more entries in the cache directory. After a particular combination of files has been aggregated once, the performance hit is pretty much non-existent.
Comment #4
MartysMind commentedAs a note, this is currently fixed in the Devel version in 5.x and 6.x. Would be nice to see this in release.