Improve Application Performance Using the Profiler

Post on 13-Dec-2014

973 views 1 download

Tags:

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

Improve Application Performance Using the Profiler

By Chris Black@chrisjblack

Aw, Snap!

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

Background

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

• My devices…– BlackBerry– Android– iPod Touch

WHY IS MEMORY MGMT IMPORTANT?

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

Reputation of Scripting Languages

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

• People see the result, not the cause

HOW TO CRASH THE BROWSER

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”);}

Memory Leaks

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

}

• This is where the memory profiler comes in handy!

MANAGING MEMORY

Garbage Collection

• Runtime removes unused items

• Garbage collection is expensive and CPU intensive

• Re-use display objects as much as possible

Store Data to the Hard Drive

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

• Requires additional management

Memory Profiler

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

Live Demo

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

Questions?