Last active
September 17, 2015 16:22
-
-
Save AxGord/3ab942fe6cbab5d0704e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import pony.events.Signal; | |
/** | |
* ... | |
* @author AxGord <[email protected]> | |
*/ | |
class SignalTest { | |
static function main() { | |
var a = 0; | |
for (i in 0...1000000000) a++;//Power up | |
trace('Begin test'); | |
var k = 3000; | |
var ms = time(); | |
for (i in 0...k) { | |
var a = 0; | |
var b = 0; | |
var s = new Signal1<String>(); | |
s << function() a++; | |
s << function() b--; | |
for (i in 0...k) s.dispatch('qwe'); | |
} | |
trace(time() - ms); | |
var ms = time(); | |
for (i in 0...k) { | |
var a = 0; | |
var b = 0; | |
var s:pony.events.Signal1<Void,String> = Signal.createEmpty(); | |
s << function() a++; | |
s << function() b--; | |
for (i in 0...k) s.dispatch('qwe'); | |
} | |
trace(time()-ms); | |
} | |
#if (neko||php||java||cs||cpp) | |
static function time() return Sys.time(); | |
#else | |
static function time() return Date.now().getTime(); | |
#end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment