Another performance post: flash.geom.sealedWhatever

October 9th, 2007

Not sure if I am totally tripping, but I just tried to extend flash.geom.Matrix with a sealed final class version, and it seems to be faster.

1m loops of a matrix.a++, and matrix.concat(matrix);

normal flash.geom.Matrix 871
extended sealed matrix: 853
extended sealed matrix: 853
normal flash.geom.Matrix 871
extended sealed matrix: 852
normal flash.geom.Matrix 870

very interesting indeed. I did a test with a flash.geom.Point, but couldn’t find any results saying it was faster or slower. If any of you find results different than this, please let me know.

package {

	import flash.geom.Matrix;
	import flash.utils.*;
	import flash.display.Sprite;
	import flash.events.Event;

	public class SpeedTest1 extends Sprite {

		public function SpeedTest1():void {

			addEventListener(Event.ENTER_FRAME, runTest);
		}

		private function runTest(event:Event):void {
			removeEventListener(Event.ENTER_FRAME, runTest);

			var count:int, matrix:Matrix, sealed:SealedMatrix, start:int;

			matrix = new Matrix();
			sealed = new SealedMatrix();

			start = getTimer();
			for (count = 0; count < 1000000; count++) {
				matrix.a++;
				matrix.concat(matrix);
			}
			trace('matrix', getTimer()-start);

			start = getTimer();
			for (count = 0; count < 1000000; count++) {
				sealed.a++;
				sealed.concat(sealed);
			}
			trace('sealed', getTimer()-start);

			start = getTimer();
			for (count = 0; count < 1000000; count++) {
				sealed.a++;
				sealed.concat(sealed);
			}
			trace('sealed', getTimer()-start);

			start = getTimer();
			for (count = 0; count < 1000000; count++) {
				matrix.a++;
				matrix.concat(matrix);
			}
			trace('matrix', getTimer()-start);

			start = getTimer();
			for (count = 0; count < 1000000; count++) {
				sealed.a++;
				sealed.concat(sealed);
			}
			trace('sealed', getTimer()-start);

			start = getTimer();
			for (count = 0; count < 1000000; count++) {
				matrix.a++;
				matrix.concat(matrix);
			}
			trace('matrix', getTimer()-start);
		}
	}
}

import flash.geom.Matrix;

final class SealedMatrix extends Matrix {

}

Creating generative performances and videos using Onyx

October 4th, 2007

I was a bit exhausted last night after getting back from MAX, but I really wanted to experiment with an idea I’ve had in my head for the last couple weeks. A couple years ago my sister showed me a piece she had danced in (when she was still bald even) — a piece originally created by Josh Ott and Nini Hu called “Strings”. I wish I could find it online — it was beautiful contemporary dance/video piece — and I wanted to see if I could somehow mimic it in a real-time performance. I also wanted to show that Onyx can be used to build generative pieces, it’s not just a video player with filters. Playing off the video painting idea I created a while back, here’s what I came up with.

This is recorded in real time with 2 painting layers, and some added duplicate effect layers. Music by Thom Yorke (only a few more days til the new album).