Skip to content

Instantly share code, notes, and snippets.

@rphillips
Created November 17, 2014 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rphillips/8506bb12e825ac68f6c1 to your computer and use it in GitHub Desktop.
Save rphillips/8506bb12e825ac68f6c1 to your computer and use it in GitHub Desktop.
var EventEmitter = require('events').EventEmitter;
var util = require('util');
function Ctx() {
EventEmitter.call(this);
this.i = 0;
}
util.inherits(Ctx, EventEmitter);
Ctx.prototype.blah = function() {
// this.i++;
};
var count = 120000000;
start = (new Date).getTime();
for(i=0; i<count; i++) {
var c = new Ctx();
c.blah();
}
end = (new Date).getTime();
console.log(count / (end - start));
local Emitter = require('core').Emitter
local count = 1200000000
local o = Emitter:extend()
function o:initialize()
self.i = 0
end
function o:blah()
-- self.i = self.i + 1
end
local start = os.clock()
for i=1, count do
local ctx = o:new()
ctx:blah()
end
local e = os.clock()
p(count / (e - start))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment