jweinst1
12/24/2016 - 7:21 AM

js bench mark comparing transpile vs interpret

js bench mark comparing transpile vs interpret

//compile time vs interpretive calling

console.time("evalroute");
for(var i=0;i<10000;i++) eval("var x = {states:[function(){return 4 + 5;}]};x.states[0]()");
console.timeEnd("evalroute");

var x = {states:[function(){return 4 + 5;}]};
var dict = {"loot":x};
var key = "loot";

console.time("interproute");
for(var j=0;j<10000;j++) if(key in dict) {x.states[0]()};
console.timeEnd("interproute");

/*evalroute: 28ms
interproute: 3ms*/