Benchmarking: Results

Posted: December 21st, 2008 under ActionScript 3.0, Optimization.

Sweet Sweet Benchmarking A speed comparison across all trials. If you would like to view the full results they are available in cvs, htm, and xls formats.

Computer A

Speed
(milliseconds)
Possible executions
inside a frame
(a frame = 1/60 second)
Relative Speed Operation(s)
1.3749 12 343,725
  • Drawing a 250×250 png
0.7711 21 192,775
  • Drawing a 250×250 jpg
0.65 25 162,500
  • Drawing a 250×250 vector w/ alpha
0.35 47 87,500
  • Drawing a 250×250 vector
  • Drawing a 50×50 png
  • Drawing a 50×50 jpg
0.27 61 67,500
  • Drawing a 10×10 jpg
  • Drawing a 10×10 png
0.15 111 37,500
  • Drawing a 50×50 vector
  • Drawing a 50×50 vector w/ alpha
  • Drawing a 10×10 vector
  • Drawing a 10×10 vector w/ alpha
0.055 302 13,750
  • Initializing a sprite
0.0036 4,627 900
  • Sprite.getRect()
  • Sprite.getBounds()
0.0022 7,575 550
  • Sprite.hitTestPoint()
0.0008 20,825 200
  • Sprite.dispatchEvent()
0.00055 30,290 137.5
  • Sprite.width
0.0005 33,320 125
  • Sprite.swapChildren()
0.00032 52,062 80
  • Sprite.name
0.00015 111,066 37.5
  • Math.random()
0.000055 302,909 13.75
  • Array write
0.000025 666,400 6.25
  • Array read
  • BitmapData.getPixel32()
  • Sprite.x
  • Sprite.numChildren
  • Sprite.alpha
  • Sprite.visible
  • Sprite.contains()
0.000018 925,555 5.5
  • Division
0.000012 1,388,333 3
  • Simple function call
  • Operations including promotion
<= 0.000004 4,165,000 1
  • Addition
  • Multiplication
  • Iterating
  • Bit shifting
  • Casting
  • Declaring a variable
  • Directly accessing a class variable

Computer D

Speed
(milliseconds)
Possible executions
inside a frame
(a frame = 1/60 second)
Relative Speed Operation(s)
0.3 55 75,000
  • Drawing a 250×250 png
0.2 83 50,000
  • Drawing a 250×250 jpg
0.17 98 42,500
  • Drawing a 250×250 vector w/ alpha
0.125 133 31,250
  • Drawing a 10×10 jpg
  • Drawing a 10×10 png
  • Drawing a 50×50 jpg
  • Drawing a 50×50 png
0.1 167 25,000
  • Drawing a 250×250 vector
0.05 333 12,500
  • Drawing a 50×50 vector
  • Drawing a 50×50 vector w/ alpha
0.04 416 10,000
  • Drawing a 10×10 vector
  • Drawing a 10×10 vector w/ alpha
0.018 926 4500
  • Initializing a sprite
0.0016 10,417 400
  • Sprite.getRect()
  • Sprite.getBounds()
0.00107 15,567 267.5
  • Sprite.hitTestPoint()
0.00042 39,683 105
  • Sprite.swapChildren()
  • Sprite.dispatchEvent()
0.00032 52,062 80
  • Sprite.name
  • Sprite.width
0.000062 268,817 15.5
  • Math.random()
0.000030 555,555 7.5
  • Array write
0.000025 666,400 6.25
  • BitmapData.getPixel32()
  • Sprite.x
  • Sprite.numChildren
  • Sprite.alpha
  • Sprite.visible
  • Sprite.contains()
0.000012 1,388,333 3
  • Simple function call
  • Operations including promotion
  • Array Read
<= 0.000004 4,165,000 1
  • Addition
  • Multiplication
  • Division
  • Iterating
  • Bit shifting
  • Casting
  • Declaring a variable
  • Directly accessing a class variable

This table does not have the results from every trial; it would particularly do a disservice to the trials with significant overhead. Nor does this table address optimizations or alternatives that you can implement. However, a relative comparison across the bulk of the trials puts cost in perspective. The 19 most expensive operations are all concerning graphics. Due note that the speed at which vectors are drawn is based on graphic complexity – not size. These vector objects were squares, so the render speed should be a minimum. Conversely, png and jpg render speed is based on image size regardless of contents so its speed should be constant.

Optimization practices and an appropriate art strategy should be planed from the beginning of any project. At the same time, we live in an imperfect world and work under changing demands. If a project’s performance starts to decrease during development, the most efficient optimizations you can make are to your graphics. With experience, you will get better at striking the balance between optimizing artwork and ActionScript. Inevitably, performance bugs will happen, hopefully now you should be able to quickly diagnose the problem and be able to implement some alternatives.

Thanks for reading, and remember, we are all in this together.

This post is part of a series:
Introduction
Methodology
Operation Speed
Data Structure Speed
Graphics Speed
Results <– You are here

submit to reddit
Delicious Bookmark this on Delicious

4 Comments »

  • Comment by Baz — July 13, 2009 @ 11:19 pm

    1

    You did a huge work.
    I have learnt a lot and have many things to put in practise now.
    Thanks a lot for sharing.


  • Comment by Igor — April 2, 2011 @ 10:42 am

    2

    Thanks, man!
    Reading this was REALLY helpful!


  • Comment by man — May 17, 2012 @ 7:53 am

    3

    thank you very much for your time! =*^_^*=


  • Comment by benjamin guihaire — August 6, 2013 @ 8:56 am

    4

    for AS3 profiling, the best is to use adobe Scout, its also good to know AS3 best practices in general while coding, and look at optimizations techniques over internet (see my blog: http://www.guihaire.com/code)


RSS feed for comments on this post. TrackBack URL

Leave a comment