One of my favorite sessions for FITC was Flash Player Internals by Jim Corbett, who as Colin Moock commented, is "a real, live Flash Player engineer". Jim proved to be a really great, energetic presenter, talking quickly, giving all sorts of great insight on how the Flash Player 9 works as well as information about Flash Player 10.

Jim Corbett

Probably the biggest news, which I hadn’t heard before this session, is a little sort of cheat on how to get multithreading in Flash Player 10!

For anyone who doesn't know what the overall concept of threading or multithreading means in programming, you can check out the wikipedia entry. However, in terms of Flash the most obvious example means that in applications when doing something CPU intensive like parsing through a large amount of data, the framerate drops and the UI becomes unresponsive because Flash is single threaded when it comes to the ActionScript Virtual Machine. There are ways around the problem now, like keeping track of how many milliseconds a function is taking and cutting out of the function if it's taking too long so that the UI has a chance to respond to the user events. However, if there was multithreading in Flash there wouldn't be any need for that overhead and you could have the UI actions inside a separate thread from the rest of your application. Also using another thread of the CPU allows for increases in speed.

So will multithreading be available in Flash Player 10? Yes and no. Jim Corbett said multithreading wasn’t being built into the ActionScript Virtual Machine, however, processing for the new bitmap filters using the programming language Hydra would be using multithreading! What’s more is that you don’t need to focus on manipulating DisplayObject items with Hyrda, but are able to send it plain math equations as well, which it will be able to crunch blazingly fast, thanks to multithreading! So any math heavy Flash applications will get a HUGE performance boost, not to mention the various 3D engines and physics engines.

Jim went over other new features for Flash Player 10 that had previously been announced such as:

  • a new text rendering engine
  • 2.5D perspective rendering for a fake 3D look
  • typed arrays – which should result in a speed boost whether arrays are used
  • plus a lot more that he’s not allowed to talk about

While there were a number of new demos and announcements about Flash Player 10 and Flash CS4 at FITC, I imagine that they are holding back the really big new features and announcements for Adobe MAX 2008. Jim did include GPU (graphics processing unit) in a slide of “new and future tech”, but there was no mention that GPU acceleration would be in Flash Player 10. However, that’s the type of big announcement that I imagine Adobe would want to save for MAX.

Also I have to mention that while the Adobe code-name for Flash Player 10 is “Astro”, the Flash Player team has their own code-name for it… Bacon! That’s the name that the team voted for, they didn’t get that name, but still refer to it internally as Bacon. Flash Player 9 Update 3 was code-named Moviestar, but once again the internal Flash Player team referred to as Frogstar.

Director comparisons to Flash were brought up and Jim mentioned that a lot of knowledge of pixel work in Director has been moved into Flash helping to make it more powerful. Jim as well as other members of the Flash Player team had previously worked on the Director team.

The whole session wasn’t just on Flash Player 10, but also how Flash Player 9 currently works, including the following AS3 optimizations:

  • use typed variables whenever possible
  • avoid globals whenever possible, especially when code is deeply nested (loops)
  • follow the warnings given when using the strict mode for the compiler for faster code
  • accessing arrays with integers (foo[1]) are faster than accessing arrays with strings (foo[“bar”])
  • sealed classes are a faster than dynamic classes, so use the final keyword whenever possible
  • use weak references for events whenever possible

It was a really great presentation, with a lot of information on optimization that I can use in my day to day job. Now I don’t think Jim is posting his slides anywhere, but if you’re interested in more about the internal workings of the Flash Player check out this blog link for the first of four blog entries going into more detail about the part of Jim’s presentation on how the Flash player works. The blog postings cover Jim’s presentation from MAX 2007, but it seems like it was a similar presentation to the one at FITC, with additional Flash Player 10 information added to it.