flash on 2012-7-24
import flash.display.Sprite;
...
@author jc at bkzen
♥0 |
Line 105 |
Modified 2012-07-24 17:02:07 |
MIT License
archived:2017-03-20 06:41:49
ActionScript3 source code
/**
* Copyright bkzen ( http://wonderfl.net/user/bkzen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/adcC
*/
package
{
import com.actionscriptbible.Example;
//import flash.display.Sprite;
import flash.utils.getTimer;
/**
* ...
* @author jc at bkzen
*/
public class Test116 extends Example
//public class Test116 extends Sprite
{
public function Test116()
{
var L: int = 5000000;
(function(n: int): void
{
var i: int, t: int = 0;
var j: int = getTimer();
for (i = 0; i < n; i++)
{
t++ ;
}
trace("a", getTimer() - j);
})(L);
var b: Function = function(n: int): void
{
var i: int, t: int = 0;
var j: int = getTimer();
for (i = 0; i < n; i++)
{
t++ ;
}
trace("b", getTimer() - j);
};
b(L);
var c: Hoge = new Hoge(function(n: int): void
{
var i: int, t: int = 0;
var j: int = getTimer();
for (i = 0; i < n; i++)
{
t++ ;
}
trace("c", getTimer() - j);
});
c._f(L);
var d: Hoge = new Hoge(null);
d._f = function(n: int): void
{
var i: int, t: int = 0;
var j: int = getTimer();
for (i = 0; i < n; i++)
{
t++ ;
}
trace("d", getTimer() - j);
};
d._f(L);
var e: Hoge = new Hoge(null);
e.test(function(n: int): void
{
var i: int, t: int = 0;
var j: int = getTimer();
for (i = 0; i < n; i++)
{
t++ ;
}
trace("e", getTimer() - j);
});
e._f(L);
test(function(n: int): void
{
var i: int, t: int = 0;
var j: int = getTimer();
for (i = 0; i < n; i++)
{
t++ ;
}
trace("f", getTimer() - j);
}, L);
var g: Hoge = Hoge.create(function(n: int): void
{
var i: int, t: int = 0;
var j: int = getTimer();
for (i = 0; i < n; i++)
{
t++ ;
}
trace("g", getTimer() - j);
});
g._f(L);
}
private function test(f: Function, L: int):void
{
f(L);
}
}
}
class Hoge
{
public var _f: Function;
function Hoge(f: Function) { _f = f; }
public function test(f: Function): void { _f = f; }
public static function create(f: Function): Hoge
{
var h: Hoge = new Hoge(null);
h._f = f;
return h;
}
}