Skip to content

Instantly share code, notes, and snippets.

@AxGord
Last active September 17, 2015 16:22
Show Gist options
  • Save AxGord/3ab942fe6cbab5d0704e to your computer and use it in GitHub Desktop.
Save AxGord/3ab942fe6cbab5d0704e to your computer and use it in GitHub Desktop.
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