-
-
Save rphillips/8506bb12e825ac68f6c1 to your computer and use it in GitHub Desktop.
This file contains 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
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)); |
This file contains 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
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