Posts Tagged ‘flex’

Performance Tips for RIA

Sunday, August 26th, 2007

One of the tools I have been appreciated over the past week or so is something called YSlow, a validator for Steve Sounders Rules for High Performance Websites, built as a plug-in for Firebug. It has got me thinking, thats all very well and good when we talk about mostly static web experiences, but how do they apply to rich internet applications, built using the likes of Flash or Flex.

Many of the performance rules such as consolidating CSS and JavaScript, moving CSS to the top of your document etc. are not really applicable in this case. Whereas some rules such as reducing the number of HTTP requests will always be relevant.

Lets have a look and see if we can produce our own set of performance tips specifically for RIA developers. All comments appreciated!

Performance Tips for Flash/Flex Rich Internet Applications

  1. Make fewer HTTP requests in your containing HTML page.
    As the average browser can only make up to 6 concurrent HTTP requests out-of-the-box, it is important that your HTML page is optimized for this. As you will likely be using a JavaScript library such as SWFObject in order to embed your RIA, this functionality will not be executed until the page is loaded, meaning that the SWF file will likely be towards the end of the download queue. Thats fine, unless the browser is tied up with downloading other items… For the end user this means they will spend longer looking at an empty page, which is not a good experience.
    In order to solve for this, one should refer to the wisdom of YSlow.
  2. Manage User Expectations.
    The likelihood is that your SWF file is going to be fairly heavy, and take a not-insignificant amount of time to download. This is especially true if you are using the Flex framework within your application. If this is the case, it is absolutely essential that you consider giving the user feedback that something is loading, and how long it is going to take. It prevents abandonment and makes the whole experience seem more responsive.
    Similarly, if at any point an application is required to go off and load more data, similar user feedback should be employed if the response is going to take more than a second.Some would argue that the use of preloaders is indicative of a slow application, that may be true, but a longer perceived load time and unresponsive UI are probably more indicative of a slow application!
  3. Prioritize Dynamic Content.
    Its easy to get carried away when building applications, externally loading XML files, CSS files and background images so that pretty much every aspect of your application is configurable by external files, rather than a recompilation. Fantastic, except when we consider that all of these files need to be loaded before the application can even thing about rendering.
    Its worthwhile to make a list of all the data files and graphical assets which your application needs to load pre-render. Prioritize these based on how often each particular item is likely to be updated. Consider relocating some of these assets inside your SWF.Its nice to specify text styles using CSS or XML, but if no-one is likely to change it, then do you need it, especially since this could be relocated to an ActionScript class and potential shave a second or two off load time.
  4. Consolidate External Data.
    Calls to external services are expensive, often with a round-trip response time of a second or so, and usually coupled with a second call to a crossdomain.xml file. These are a bottleneck, and there is nothing that can be done here. However, if you are making multiple calls, consider consolidating them by developing a server side component which can make both calls, merge the data and return the result. This reduces the client-side overhead, and lets you manipulate the results on the server side if necessary, making your application feel more responsive.
  5. Load Cross Domain files up front.
    If a service call is inevitable, consider loading the crossdomain.xml file up front to avoid delaying your initial service requests.
  6. Don’t be afraid to cache data.
    If data is unlikely to go out of date, or if you want your UI to appear responsive, pre-populated with data, then why not cache data on the client? Data can be stored in a local shared object, and retrieved on the next load of the application. This creates the impression of a responsive UI and can save on HTTP requests.
    In the background, its important to set an expires property so that you can manage data refreshes, based on the lifetime of the data in question. Weather information may have a lifetime of an hour or so, whereas a user’s profile information often has a lifetime of at least a few days.If data is secure then this method should not be used, unless in conjunction with encryption, as the shared object is accessible on the user’s filesystem.

(more…)

SkillSwap Aftermath!

Friday, July 20th, 2007

Thanks to everyone who came along to the SkillSwap on Wednesday - I hope you enjoyed it and learned something!
The slides are online and available for download (11Mb PDF), and if you have any questions, please post them in the comments or drop me an email.
In response to the person who asked “Is there any screen capture functionality within AIR?, I’m afraid at the moment the answer is no - its not in the roadmap for the 1.0 release as far as I can tell. However, if you just want to capture the AIR application itself, then it should be possible to save just that window as bitmap data using AS3.0.

var capture:BitmapData = new BitmapData(UIComponent(mx.core.Application.application).width,UIComponent(mx.core.Application.application).height);var m:Matrix = new Matrix();capture.draw( UIComponent(mx.core.Application.application), m );

If you are looking for screen-sharing options, then I would heartily recommend Adobe Acrobat Connect which is just great for presentations and/or collaborative working.

(more…)

ApolloCamp Roundup

Wednesday, March 21st, 2007

As already posted, I have been over in San Francisco this weekend. The purpose of my trip? Well.. partly sightseeing but mainly for Adobe’s ApolloCamp event - an evening dedicated to Apollo, Adobe’s new desktop application platform. Here is a roundup of some of the secrets gleaned at the event!

For over 10 years now, Flash has become a ubiquitous standard on the web, installed on an estimated 750 million PC’s. It is cross-platform, and cross-browser. More recently, it has made the jump to being cross-device, with the release of Flash Lite. But what if I want to take Flash outside the browser? With access to the local filesystem and windowing API’s?

There have been several attempts at this, the most notable probably being Zinc, but most have their quirks and detractors - making it difficult to really take a complex Flash based application and deploy it to the desktop. Thats where Apollo comes in, providing a cross platform runtime for desktop applications which can either be Flash-based or HTML/JavaScript based.Currently supported platforms are Windows and Mac OS X, with Linux support being promised for the 1.0 release which is due towards the end of 2007.

Interestingly, it also appears that Adobe are interested in supporting mobile devices as Apollo moves toward 2.0, although developers shouldn’t expect this to happen until later in 2008.

So, what kind of things can Apollo do? At the event we saw lots of demo’s which were quite cool, including:* Fine Tune* Dashboard Widgets* Widgets (in General)* Twitter* E-Mail Client* BuzzWord (Word Processing)More tidbits as I continue my experimentation with Apollo….

(more…)