Flash Performance Optimizer (GreaseMonkey script)

Adobe's Flash Player can eat up quite some CPU power and sometimes the sole reason for the Flash plugin's high CPU usage is badly written embed code. Eg. the wmode=transparent embed parameter is only required if the Flash contains (and uses) transparent sections and it is necessary for correct rendering to utilize transparency. The other performance killer is the quality embed parameter: setting it to best is most of the time an overkill and totally unnecessary. Unfortunately some Flash developers (and website maintainers) lack the knowledge/time/desire to tune their embed code for optimal performance and use these parameters even if they are not needed. Flash Performance Optimizer tries to fix these problems to give you a better user experience.

Greasemonkey is a Firefox extension that allows the user to modify displayed webpages (content, behaviour, etc.) using custom JavaScript code. Flash Performance Optimizer is a Greasemonkey script that -once installed- runs on all URLS your browser (Firefox) displays, examines all embedded Flash animations and fixes "bad" embed parameters.

By default (for ease of use), only the following three configuration settings can be changed using GM user script commands:
  • Enable/disable fixing of wmode parameters.
  • Enable/disable fixing of quality parameters.
  • Enable/disable forceful permission of allowfullscreen (this has no performance penalty by default, but still some embeds do not let you to switch a Flash into fullscreen).
You can customize the script behaviour further through a set of GM variables in the about:config window of Firefox.

P.S.: my primary reason for writing this script was to speed up video playback on websites that mistakenly use either wmode=transparent or quality=best. My Mac is from 2006 and Apple does not provide GPU acceleration for "old" Macs in the framework that Adobe's Flash Player uses. So Flash content is solely CPU-rendered. Even a video of moderate size would lag seriously on my Mac (or even on my Ubuntu desktop at work) if the quality is set to best. Imho the best quality setting eats approximately twice the CPU power as the high setting (which seems to be the default for cases where quality is not specified at all). There're already a number of Flash embed code manipulating GM scripts at userscripts.org, but none of them provided the "intelligent" quality control that I wanted (ie. change quality only if it's above a predefined limit). And none of the existing scripts dealt with the wmode problem.

P.S.: recent Flash Player versions (11.*) contain lots of video playback optimizations and this GM script might not be needed at all. Eg. setting the wmode parameter to transparent seems to not cause extensive CPU usage now. It's up to you to decide whether you need this or not.

AttachmentSize
flash_performance_optimizer.user.js13.15 KB