Commit 1fbb840a authored by Leo Iannacone's avatar Leo Iannacone

update proxy libraries

parent ae6c4a69
'use strict';
/**
* Benchmark related modules.
*/
var benchmark = require('benchmark')
, microtime = require('microtime');
/**
* Logger
*/
var logger = new(require('devnull'))({ timestamp: false, namespacing: 0 });
/**
* Preparation code.
*/
var EventEmitter2 = require('eventemitter2').EventEmitter2
, EventEmitter3 = require('../../').EventEmitter
, EventEmitter1 = require('events').EventEmitter;
function foo() {
if (arguments.length > 100) console.log('damn');
return 1;
}
/**
* Instances.
*/
var ee2 = new EventEmitter2()
, ee3 = new EventEmitter3()
, ee1 = new EventEmitter1()
, j, i;
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
ee1.on('event:' + i, foo);
}
}
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
ee2.on('event:' + i, foo);
}
}
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
ee3.on('event:' + i, foo);
}
}
(
new benchmark.Suite()
).add('EventEmitter 1', function test1() {
for (i = 0; i < 10; i++) {
ee1.emit('event:' + i);
}
}).add('EventEmitter 2', function test2() {
for (i = 0; i < 10; i++) {
ee2.emit('event:' + i);
}
}).add('EventEmitter 3', function test2() {
for (i = 0; i < 10; i++) {
ee3.emit('event:' + i);
}
}).on('cycle', function cycle(e) {
var details = e.target;
logger.log('Finished benchmarking: "%s"', details.name);
logger.metric('Count (%d), Cycles (%d), Elapsed (%d), Hz (%d)'
, details.count
, details.cycles
, details.times.elapsed
, details.hz
);
}).on('complete', function completed() {
logger.info('Benchmark: "%s" is was the fastest.'
, this.filter('fastest').pluck('name')
);
}).run();
...@@ -39,9 +39,5 @@ ...@@ -39,9 +39,5 @@
"readme": "# EventEmitter3\n\nEventEmitter3 is a faster alternative to EventEmitter2 and the build-in\nEventEmitter that ships within Node.js. It removes some features that you might\nnot need:\n\n- Domain support.\n- Thrown errors when there are no error listeners specified.\n- That a `newListener` event is emitted when an event is emitted.\n- No silly `setMaxListeners`.\n- No silly `listenerCount` function.. Just do `EventEmitter.listeners(event).length`\n\nAnd adds some features you want:\n\n- Emit events with a custom context without binding: `EE.on(event, fn, context)`\n which also works with once `EE.once(event, fn, context)`\n\nIt's a drop in replacement of your existing EventEmitters, but just faster. Free\nperformance, who wouldn't want that.\n\nThe source of the EventEmitter is compatible for browser usage, no fancy pancy\n`Array.isArray` stuff is used, it's just plain ol JavaScript that should even\nwork IE5 if you want to. This module currently serves it's use in\n[Primus](http://github.com/primus/primus)'s client file.\n\n## Installation\n\n```bash\n$ npm install --save eventemitter3\n```\nor as a [component](http://component.io)\n\n```bash\n$ component install eventemitter3\n```\n\nthen\n\n```js\nvar EventEmitter = require('eventemitter3');\n\n// or\n\nvar EventEmitter = require('eventemitter3').EventEmitter;\n```\n\nFor API methods see the official Node.js documentation: \n\nhttp://nodejs.org/api/events.html\n", "readme": "# EventEmitter3\n\nEventEmitter3 is a faster alternative to EventEmitter2 and the build-in\nEventEmitter that ships within Node.js. It removes some features that you might\nnot need:\n\n- Domain support.\n- Thrown errors when there are no error listeners specified.\n- That a `newListener` event is emitted when an event is emitted.\n- No silly `setMaxListeners`.\n- No silly `listenerCount` function.. Just do `EventEmitter.listeners(event).length`\n\nAnd adds some features you want:\n\n- Emit events with a custom context without binding: `EE.on(event, fn, context)`\n which also works with once `EE.once(event, fn, context)`\n\nIt's a drop in replacement of your existing EventEmitters, but just faster. Free\nperformance, who wouldn't want that.\n\nThe source of the EventEmitter is compatible for browser usage, no fancy pancy\n`Array.isArray` stuff is used, it's just plain ol JavaScript that should even\nwork IE5 if you want to. This module currently serves it's use in\n[Primus](http://github.com/primus/primus)'s client file.\n\n## Installation\n\n```bash\n$ npm install --save eventemitter3\n```\nor as a [component](http://component.io)\n\n```bash\n$ component install eventemitter3\n```\n\nthen\n\n```js\nvar EventEmitter = require('eventemitter3');\n\n// or\n\nvar EventEmitter = require('eventemitter3').EventEmitter;\n```\n\nFor API methods see the official Node.js documentation: \n\nhttp://nodejs.org/api/events.html\n",
"readmeFilename": "README.md", "readmeFilename": "README.md",
"_id": "eventemitter3@0.1.2", "_id": "eventemitter3@0.1.2",
"dist": { "_from": "eventemitter3@*"
"shasum": "82f49c44c217e6d8cf13be4be6af527f76fecc3b"
},
"_from": "eventemitter3@*",
"_resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-0.1.2.tgz"
} }
...@@ -51,9 +51,5 @@ ...@@ -51,9 +51,5 @@
"url": "https://github.com/nodejitsu/node-http-proxy/issues" "url": "https://github.com/nodejitsu/node-http-proxy/issues"
}, },
"_id": "http-proxy@1.1.4", "_id": "http-proxy@1.1.4",
"dist": { "_from": "http-proxy@*"
"shasum": "eeee438c39b9ddeac5b475f5e886c5377cb4a8d0"
},
"_from": "http-proxy@1.1.4",
"_resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.1.4.tgz"
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment