Xfeet is a project mainly written in ActionScript, it's free.
xUnit 4 style performance test tool.
h2. Xfeet: xUnit 4 style performance test tool.
It's a xUnit 4 style version of "Grant Skinner":http://gskinner.com/blog/ 's "PerformanceTest 2":http://gskinner.com/blog/archives/2010/02/performancetest.html.
h2. Thanks
h2. Demo
h2. Examples
h3. Runner
package { import xfeet.XfeetCore; import xfeet.output.MinimalOutput; [SWF(width="550", height="400", backgroundColor="0xFFFFFF", frameRate="30")] public class XfeetDemo extends MinimalOutput { public function XfeetDemo() { super(); new XfeetCore(this).run(AllTests); } } }
You can set loops and iterations here:
new XfeetCore(this, 1000000, 10).run(AllTests);
NOTE You can set them only here and in the [Unit] metadata tag like [Unit(loops=1000000)]. Values in [Unit] will be used if exist. Use values here otherwise.
You can also run a single test unit instead of the "AllTests" suite:
new XfeetCore(this).run(OneSimpleTest);
h3. Tests
package tests { [Unit(label="Comparing floor & round to bitwise equivalents", loops="1000000")] public class Bitwise { private var foo:Array; private var i:uint; [Before] public function setUp():void { foo = []; i = 0; } [Tare] public function tare():void { i++; } [Test(label="Math.round(n), Math.floor(n), Math.floor(n/2)")] public function math():void { var a:uint = Math.floor(i / 7); var b:uint = Math.round(i / 3); var c:uint = Math.floor(i / 2); foo[i] = String(Math.random()); i++; } [Test(label="n+0.5|0, n|0, n>>1")] public function bitwise():void { var a:uint = i / 7 | 0; var b:uint = i / 3 + 0.5 | 0; var c:uint = i >> 1; i++; } } }
It's xUnit 4 style with metadatas like [Before], [After], [Test].
h3. Suite
package tests.casting { [Suite] public class CastingSuite { public var casting:Casting; public var castingPromotion:CastingPromotion; } }
Or do it like this:
package tests.casting { [Suite] public class CastingSuite { public static function suite():Array { return [Casting, CastingPromotion]; } } }
h3. Others
You can also set loops to 1 for some case:
package tests.collection { [Unit(label="Comparing cost of constructing and populating different collection types", loops="1")] public class Collections { private var loops:int = 1000000; [Test] public function array():void { var list:Array = []; for (var i:uint=0; i