With all the work I've been doing on SWF Tools recently I realised that there is quite often a noticeable delay when loading pages with lots of players on. I'm not sure how much of an issue that is in the real world, but it got me thinking.
I've just been doing some experiments with a cache mechanism for SWF Tools, and the results are phenomenal.
SWF Tools combines the incoming $files and $options, hashes them, and then caches the result ready for later calls.
Results:
3 files from CCK to JW4:
Before: 0.143215179 sec
After: 0.000478983 sec
3 files from CCK to SimpleViewer
Before: 0.123988867
After: 0.000490904
Calling a swf() with a single file from PHP in a node body:
Before: 0.09739399
After: 0.000396967
The after times are, as you'd expect, very consistent since all we do is hash up the data and try to fetch it.
The impact on a page with even only a couple of players extremely noticeable.
I'm just going to tidy the code, but this will also be in SWF Tools 6.x-3.x!
Comments
Comment #1
Stuart Greenfield commentedCommitted on HEAD (not DRUPAL-6--3 - didn't think this feature would be actually be so easy to implement as it was!)
I have given SWF Tools its own cache table as it potentially generates a lot of entries so it seems only reasonable to give it its own space.
swftools.install will install the schema. For an existing installation update 6009 will install it (so run update.php to execute this).
The playlist system has also been completely re-written (see #754734: Write xml to the cache table, not the file system) as this now uses the cache table.
Running some speed checks on the creation of bits of CCK content is consistently MUCH faster (anything between 100 and 200 times as fast once the item is in the cache). Pages feel a LOT more responsive, so generally I don't think there are going to be any issues with this.
Integration with CCK is done so that if you change profiles on the Display fields page your content reflects it.
I think this could be the best release of SWF Tools yet!
Comment #2
Stuart Greenfield commentedReleased for testing in BETA2.
Comment #3
dragonwize commentedI have not hunted down the issue but whenever the swf cache is turned on, I get the message that flash is not available, always to all anonymous users and sometimes for logged in users.