Optimization and tooling FCNY July 2010.  AS3 is only a tool  Apparat and TDSI  Wireworld code remap example  Adding your Tools to a Build Process.

Slides:



Advertisements
Similar presentations
Code Tuning Strategies and Techniques
Advertisements

CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
Great Theoretical Ideas in Computer Science
Intro to Computer Org. Pipelining, Part 2 – Data hazards + Stalls.
Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
Dynamic Typing COS 441 Princeton University Fall 2004.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
Lecture 5: Floodfill. Floodfill Overview First assume that there are no walls Give each cell a distance from the goal. The goal has distance 0. Repeat.
Java.  Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more.
Great Theoretical Ideas in Computer Science.
CS 106 Introduction to Computer Science I 12 / 04 / 2006 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 12 / 06 / 2006 Instructor: Michael Eckmann.
Snick  snack A Working Computer Slides based on work by Bob Woodham and others.
Turning Eclipse Against Itself: Finding Errors in Eclipse Sources Benjamin Livshits Stanford University.
Programming Excel Macros, Visual Basic, and Solving Your Problem.
Core Application Software Activities Ian Fisk US-CMS Physics Meeting April 20, 2001.
Cmpt-225 Algorithm Efficiency.
SM3121 Software Technology Mark Green School of Creative Media.
The Harris County Library should have a coding program for kids Anna Xu 1.
Computers They're Not Magic! (for the most part)‏ Adapted from Ryan Moore.
CS TShirts! Congratulations to Emily Kasbohm, whose T-Shirt design won! We will set up a Teespring campaign, and a link to the class if you.
A Moderately Directed Rant.  It’s very likely that you’ve been writing totally incorrect code without realizing it  Once you do realize it, it’s usually.
Antigone Engine Kevin Kassing – Period
Chocolate Bar! luqili. Milestone 3 Speed 11% of final mark 7%: path quality and speed –Some cleverness required for full marks –Implement some A* techniques.
Announcements  If you need more review of Java…  I have lots of good resources – talk to me  Use “Additional Help” link on webpage  Weekly assignments.
Going Back to Basics. What are the basics? Calls Face to Faces Campaigns Cards and letters.
Week 5 - Wednesday.  What did we talk about last time?  Exam 1!  And before that?  Review!  And before that?  if and switch statements.
1 Computer and Network Bottlenecks Author: Rodger Burgess 27th October 2008 © Copyright reserved.
Class 02 – 03 Feb 2014 Setup Where do we begin? Know your content Discovering your target user.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 15: More-Advanced Concepts.
Computer Security! Emma Campbell, 8K VirusesHackingBackups.
Linked List. Background Arrays has certain disadvantages as data storage structures. ▫In an unordered array, searching is slow ▫In an ordered array, insertion.
Stacks and Queues. 2 3 Runtime Efficiency efficiency: measure of computing resources used by code. can be relative to speed (time), memory (space), etc.
Dynamic Array. An Array-Based Implementation - Summary Good things:  Fast, random access of elements  Very memory efficient, very little memory is required.
CSS446 Spring 2014 Nan Wang.  To understand the implementation of linked lists and array lists  To analyze the efficiency of fundamental operations.
Introduction Selenium IDE is a Firefox extension that allows you to record, edit, and debug tests for HTML Easy record and playback Intelligent field selection.
LabVIEW.com.tw LabVIEW Community Speeding Up Your VIs 參考 NI 官方教材: LabVIEW Intermediate II for 7.
Copyright 2014 – Noah Mendelsohn Code Tuning Noah Mendelsohn Tufts University Web:
Review of Previous Classes Declaring Variables - var myVar:DataType = value Data Types – Number, uint, String, Boolean Functions – parameters, return.
CS 150: Analysis of Algorithms. Goals for this Unit Begin a focus on data structures and algorithms Understand the nature of the performance of algorithms.
11 Computers, C#, XNA, and You Session 1.1. Session Overview  Find out what computers are all about ...and what makes a great programmer  Discover.
Page 1 © Hortonworks Inc – All Rights Reserved Hive: Data Organization for Performance Gopal Vijayaraghavan.
The Last Lecture CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
SPI NIGHTLIES Alex Hodgkins. SPI nightlies  Build and test various software projects each night  Provide a nightlies summary page that displays all.
CSE 143 Lecture 13 Recursive Backtracking slides created by Ethan Apter
Recen progress R93088 李清新. Recent status – about hardware design Finishing the EPXA10 JPEG2000 project. Due to the DPRAM problem can’t be solved by me,
Mobile Application Development. What You Should Know About Android Studio 2.0.
E-Safety Parent Talk Helping to keep your children safe online.
BIG DATA/ Hadoop Interview Questions.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
THE BEST CRM SOFTWARE FOR YOUR BUSINESS
Development Environment
MapReduce “MapReduce allows us to stop thinking about fault tolerance.” Cathy O’Neil & Rachel Schutt, 2013.
Welcome all parents/grandparents/carers!
Sample Wiki Comments?.
UNIT 3 – LESSON 5 Creating Functions.
Stacks and Queues.
Lesson Objectives Aims
Using Data to Drive Employee Communications
Arrays versus ArrayList
Union-Find.
Tonga Institute of Higher Education IT 141: Information Systems
Min Heap Update E.g. remove smallest item 1. Pop off top (smallest) 3
10 Most Important WordPress Plugins You Must Have Website Promoters L.L.C.
Tonga Institute of Higher Education IT 141: Information Systems
1.3.7 High- and low-level languages and their translators
Interesting Algorithms for Real World Problems
Presentation transcript:

Optimization and tooling FCNY July 2010

 AS3 is only a tool  Apparat and TDSI  Wireworld code remap example  Adding your Tools to a Build Process  Q & A  Kumbaya

 Many languages can script SWFs AS3, MXML, AS2, HaXe, C, C++, Lua …  Different reasons to use each one AS3: common Alchemized C: runs fast, but hard to write HaXe: runs fast, targets practically everything  (Tramp.)

 Did you know? Alchemy C code can run at 30% the speed of native C code AS3? 3%  Use the tools at your disposal  Pick the right tools for the right job You can use more than one at a time, you know

 Behind Audiotool Joa Ebert  TAAS – bytecode analyzer, optimizer  Stripper – removes SWF debug data  Reducer – compresses PNGs in SWFs  Concrete – lets you implement abstract classes  Coverage – unit testing thingy  TDSI

 It's a car modding term. We're not supposed to get it.  Finds slow "dummy code" in your SWF that you deliberately placed in your AS3  Replaces them with Alchemy opcodes  Fast Math replacement  Memory system  Inlining and macros ?

 We’ll start with a slow AS3 app and improve it in stages.  Generally applicable strategies for optimization

 Particle system… but stuck in a grid  Information leaks from pixel to pixel  Instead of  particle.move(); particle.drop();  It’s  pixel.countNeighbors(); pixel.changeColor();  Supports circuit-like systems  WW computer by Owen and Moore (Quinapalus.com)  wireworldAS3 (Google Projects)  I get a lot of attention from Germans…?

DISCLAIMER  wireworldAS3 is needlessly complicated.  Show and tell  This complexity isn’t required from your own projects.  the Apparat project contains some example code that may be easier to follow at home

Naïve implementation for ( every row ) { for ( every column ) { there is a pixel. for ( every neighbor of the pixel ) { do something. } update the pixel's state. } }

Naïve implementation  Result: sucks  Slow, slow, slow, slow.  Touching every pixel seems dumb

New idea  List the pixels (or nodes) that might change their neighbors for ( each node in the list) { for ( each neighbor of the node) { if ( the neighbor might change its neighbors next time ) { add it to a new list } update the node } } Then swap the old list with the new list.  Way less work

 Arrays  untyped (slow)  ordered (unnecessary)  weird  push() and pop() are expensive and lame

 Linked lists are easy: every node points to the next node in the list  start  node  node  node  node  null  Chop it and you get two LLs  Connect their ends and they’re one again  No pushing or popping  No class  Result: better

 Grab that second beer.  Optimization is never an end unto itself It’s so easy to forget that Performance matters in four or five situations: 1Addressing bad user experience, freezing process 2Facing stiff competition 3Porting code to mobile devices 4 plotting world domination  Otherwise, don’t we all have enough on our plates already?

 How about filters? Pixel Bender?  Wireworld rule is basically a weird BitmapFilter  These work, but they're slow  Remapping to these is scary  Some tasks can be PBJ'd, but not all of them  Result: disappointing

Property Vectors instead of objects  Make a Vector for each node property  xVec, yVec, stateVec  node.next.x becomes xVec[ nextVec[ i ] ]  Replaces the node class with ints, Booleans and other Vectors  The Vectors don't grow or shrink, but the data changes its value  Nodes now point to each other with an index  The linked lists are still in there

Property Vectors instead of objects  Wait! We can't use null.  You have to make a custom null. Call it something else. Nada. Diddly. Buggerall. Squat. Bupkis.  It’s just an int, like -1, that we use to signify nothingness.  Doesn’t work well with dynamic properties  There are ways around this  Maybe you shouldn’t be using dynamic properties  Result: on par with linked lists  Main advantage: all the data is primitive.

ByteArray time  We can pack our primitive data into a BA  Write out the values of each property for each cell, same order every time.  Result:  SUCKS!

Wait. What??

 Use TDSI’s Memory API  Slows your program way down at first  (Don’t freak out)  Run the SWF through TDSI  Result: Excellent

 Cut a big loop into a repeatable task  Perform the task in response to a timed event  Stop the task when the loop test fails  Overdrive  Packing the flash event loop  Framerate threshold  Don’t forget to solve the problem

 Wireworld won’t impact most people.  Other systems can seriously benefit Audio players/synths Emulators Graphics engines Solvers Tough stough

 Consider: This is probably the most efficient SWF we've ever compiled during a talk at FCNY  Hard task  Runs fast  Targeting mobile devices Your app will stand a better chance (Apparently WW already runs nice on Froyo)

 Bash script / Bat file Write it just once Tack it on the end of your FB builders list Register it as an external build tool  Most IDEs offer some way of doing this Double click it  Ant build for Eclipse fans  AGAIN: implementation before optimization BAT BASH

 Please direct all your questions to Hudson. Thank you.