Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.utils.*;
- public final class test2
- {
- public var i:int;
- public var start:int;
- public var controlList:ByteArray;
- public function test2():void
- {
- start = getTimer();
- controlList = new ByteArray();
- controlList.length = 4096;
- }
- public const MAX_RATIO:Number = 1 / uint.MAX_VALUE;
- public var r:uint = Math.random() * uint.MAX_VALUE;
- public final function XORandom():Number
- {
- r ^= (r << 21);
- r ^= (r >>> 35);
- r ^= (r << 4);
- return (r * MAX_RATIO);
- }
- public final function getTargets( s:int ):Vector.<int>
- {
- var t:Vector.<int> = new Vector.<int>();
- var i:int;
- var j:int;
- s = s<<6;
- do
- {
- if (controlList[s|i])
- {
- t[j++] = i;
- }
- }
- while(i++ < 63);
- return t;
- }
- public final function loop1():void
- {
- for (i=0; i<4096; i++)
- {
- controlList[i] = int( XORandom() );
- }
- }
- public final function loop2():void
- {
- for (i=0; i<10000000; i++)
- {
- getTargets( int( XORandom() << 6 ) );
- }
- }
- }
- var t2:test2 = new test2();
- t2.loop1();
- t2.loop2();
- trace("done in", getTimer()-t2.start, "ms");
- }
- /*
- java -jar asc.jar -AS3 -strict -import builtin.abc -import toplevel.abc test3.as
- test3.abc, 893 bytes written
- done in 17722 ms
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement