jpauclair.net: 6 Months – Articles recap.
For those who started reading only a few weeks or months ago, here is a recap of the technical articles of my blog:
Tamarin Part I: AS3 Array
private function InitializeArray() : void { var i:int = 0, myArray:Array = new Array(); for (i = 0; i < 100000; i++) { myArray[i] = i; } } private function InitializeArrayBackward() : void { var i:int = 0, myArray:Array = new Array(); for (i = 100000; i >=0; i--) { myArray[i] = i; } }
When testing those two functions in GSkinner PerformanceTest, I get this:
InitializeArray : 11 ms
InitializeArrayBackward : 44 ms
There is something very important to understand when using the Array class.
If you read the Tamarin source code you will discover that Array is made of multiple things…
Tamarin part II – More on Array and Vector
Start a flash app with
var a:Vector.<int> = new Vector.<int>(1024 * 1024);
Would result in a total memory use (System.totalMemory: including all the other junk)
System.totalMemory = 7 311 360
So now let’s fill this array
var a:Vector.<int> = new Vector.<int>(1024 * 1024); for (var i:int = 0; i <= 1024 * 1024; i++) { a[i] = 0 }
System.totalMemory = 8 364 032
WHAT!! That’s a 1 052 652 bytes (1 Mo) hole! ouchh
Base64 Optimized as3 lib
I went through both lib (as3Crypto and PHPRPC protocol) and optimized what I could in the base64 encoding/decoding. The final version is ~700% faster with almost no heap expansion compare to both libs.
as3Crypto is currently adding the modified version to its core
Reverse engineering AMF3 Vector for Java
Did you ever worked in AS3 with Byte Array and AMF data serialization for transferring object over network ? It really simplify everything. Of course there is a size overhead. But the bottom line is that we can save hundreds of hours by using it.
Since Flash 10, there is one big flaw with AMF: it doesn’t support Vector. Well it’s not true, The FlashPlayer support it, but not what link to it. So you still can serialize Vector object in a byte array and save it in a file for example, but you can’t send it to a web page written in PHP or a server in Java because there is no implementation of those new « flash 10 features (Vector, Dictionary,…)» in the flex framework.
Project Red5 (OSS Socket server) has used it to implement in their engine.
Get around Flash documentation: Read more
AS3 hidden treasure in the mm.cfg file. Revealing and documenting many Flash secrets!
Very simple: 45 undocumented feature of Flash Player!
One SWF to rule them all : The Almighty PreloadSWF
This is onw of the “almost hidden” feature of the mm.cfg
Simply said, it enables you to load a SWF before any other running swf and manipulate any as3 online SWF .
Flash Assembler (not ByteCode) : And you thought it couldn’t get faster
One of the hidden feature of the mm.cfg enables you to output flash JIT-generated assembler to a file.
Here is how to use it for optimization.
Flash Preload Profiler
Using one of the hidden mm.cfg features again to show how powerful the preloadSWF is.
This “Flash preload Profiler” is a multi-purpose profiler that enables you to diagnose visual performance problems before they get too big.
What’s in the next 6 months?
Trackbacks & Pingbacks
Comments are closed.
Thanks for a great six months!
I agree! excellent stuff here .
Very good posts indeed. Congrats and Thanks.
I have been pretty busy recently so just caught up with this. Your articles are fantastic JP, keep going! (I ask selfishly – I would never know this stuff if you didn’t tell me). Thanks.