Improve Application Performance Using the Profiler
-
Upload
chris-black -
Category
Technology
-
view
974 -
download
1
description
Transcript of Improve Application Performance Using the Profiler
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?