connectedpixel.com

actionscript, web development

Performance

Preloader strategy examples

Submitted by joelmay on 11 March, 2008 - 10:38am.

Here's a excellent tutorial on preloader animations. Includes human interface implications.

Read more

AS2: Static vs. Instance vs. Setter Funcs

Submitted by joelmay on 7 September, 2005 - 1:22pm.

Flash has several ways to define a function:

  • Class methods
  • Setter/getter methods
  • Static class methods
  • Local functions

I wrote equivalent functions in each form and compared their performance. The raw data is down below in the appendix. I'll go over the results here that I find surprising:

Setter/Getters vs. Regular Instance Functions

// Setter/Getter
p.XVal = 23.4;        // 25 msec / 1000
x = p.XVal;           // 12 msec / 1000

vs.

AS2: Performance Impact of OO Coding Style

Submitted by joelmay on 1 September, 2005 - 11:27pm.

While writing that animated sine-wave thingy at the top of my web site, I ran into a problem -- my frame rate was terrible. I was getting maybe 3 or 4 frames a second. My browser was bogging down, my computer was bogging down. I had to either speed it up, or I had to dump it.

As it has many trig calculations in each frame, I thought that Math.sin() was to blame. I was getting ready to write a table-lookup algorithm to replace Math.sin, when the little angel on my shoulder told me to quit guessing and be more scientific about it. So I wrote a test program instead. I found that Math.sin was extremely fast and certainly not the cause of my problem.

XML feed