Improve Application Performance Using the Profiler

16
Improve Application Performance Using the Profiler By Chris Black @chrisjblack

description

Both Flash Builder Pro and the free alternative, Flash Develop, include an invaluable tool called the memory profiler. Take full advantage of this tool to increase the performance of your apps and prevent browser crashes. We'll also cover some common mistakes when building interactive web applications. This presentation is for anyone who is unfamiliar with the profiler or hasn't used it before.

Transcript of Improve Application Performance Using the Profiler

Page 1: Improve Application Performance Using the Profiler

Improve Application Performance Using the Profiler

By Chris Black@chrisjblack

Page 2: Improve Application Performance Using the Profiler

Aw, Snap!

Page 3: Improve Application Performance Using the Profiler

What Causes a Browser to Crash?

• Poor code written in ANY programming language

• All browsers in the previous slides crashed using JavaScript

• Both JavaScript and ActionScript can perform poorly and crash the browser when written incorrectly

Page 4: Improve Application Performance Using the Profiler

Background

• I am a self employed…– ActionScript developer– Mobile applications developer– Google AdWords consultant

• My devices…– BlackBerry– Android– iPod Touch

Page 5: Improve Application Performance Using the Profiler

WHY IS MEMORY MGMT IMPORTANT?

Page 6: Improve Application Performance Using the Profiler

Mobile Development

• When building applications for mobile it is even more important to consider memory management

• Devices are running on a fraction of the CPU and memory of desktop computers

Page 7: Improve Application Performance Using the Profiler

Reputation of Scripting Languages

• Flash doesn’t crash browsers, poor development crashes browsers in all languages

• People see the result, not the cause

Page 8: Improve Application Performance Using the Profiler

HOW TO CRASH THE BROWSER

Page 9: Improve Application Performance Using the Profiler

Infinite Loops

while(1){n += “You shouldn’t have done that”;

} // this JS will crash IE, Firefox and Safari

var data = new Array(“1”);for(var n; n < data.length; n++){

data.push(“1”);}

Page 10: Improve Application Performance Using the Profiler

Memory Leaks

addNextItem(data){var item = new Item(data);

}

• This is where the memory profiler comes in handy!

Page 11: Improve Application Performance Using the Profiler

MANAGING MEMORY

Page 12: Improve Application Performance Using the Profiler

Garbage Collection

• Runtime removes unused items

• Garbage collection is expensive and CPU intensive

• Re-use display objects as much as possible

Page 13: Improve Application Performance Using the Profiler

Store Data to the Hard Drive

• Saves loading time and allows for re-use of components

• Requires additional management

Page 14: Improve Application Performance Using the Profiler

Memory Profiler

• FREE memory profiler with Flash Develop• Also comes with Flash Builder Pro and FDT

Page 15: Improve Application Performance Using the Profiler

Live Demo

• Use the profiler in Flash Develop to manage memory within your application

Page 16: Improve Application Performance Using the Profiler

Questions?