I have noticed a problem with aggregated (optimized) CSS and JS files.
Aggregation tries to save the bandwith, but the problem is that on the different pages different css or js files could be included, which leads to generated files with different names. And as a result the users which are visiting 3 pages which differs only in 1 or 2 small js or css files have to load all the scripts 3 time. It is a huge overhead! (I can compare to my page: in my js folder I have 4 js files with sizes 90-120KB).
So there are 2 solutions: 1 - disable aggregaton, 2 - include all the needed files on all pages. I have used the second solution, but noticed than there are JS and CSS files produced, which have the same size, the same content but different names. Of course, the browser has to download all these files at least one time.
After a little hacking with core I have found that the problem lies in the hashing of the filename. As an argument it uses the array of files that should be aggregated. And depending of the page, these files can get into array in different order, resulting in different hash but the same content.
So I have created a small patch, where a temporary array is sorted and used for generation of the name.

CommentFileSizeAuthor
common.patch1.34 KBmakushkin

Comments

makushkin’s picture

Status: Active » Needs work
makushkin’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, common.patch, failed testing.

momper’s picture

subscribe

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.