Last active
August 29, 2015 14:19
-
-
Save umamialex/1e6b7af24e13d491ec45 to your computer and use it in GitHub Desktop.
EventEmitter, Bluebird, Lodash Memory Test
This file contains hidden or 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
{ | |
"name": "eventemitter-bluebird-lodash-memory-test", | |
"version": "0.1.0", | |
"description": "A test for RSS memory growth using EventEmitter, Bluebird, and Lodash.", | |
"main": "server.js", | |
"dependencies": { | |
"bluebird": "^2.9.24", | |
"lodash": "^3.7.0", | |
"memory-logger": "git+https://gist.github.com/01d17e3280841c01d75e.git" | |
}, | |
"devDependencies": {}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"start": "node server.js" | |
}, | |
"author": "Alexander Martin", | |
"license": "MIT" | |
} |
This file contains hidden or 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 _ = require('lodash'); | |
var Promise = require('bluebird'); | |
var EventEmitter = require('events').EventEmitter; | |
var eventEmitter = new EventEmitter(); | |
var testAsync = function testAsync() { | |
return new Promise(function(resolve, reject) { | |
setTimeout(_.partial(resolve, 'goodbye'), 100); | |
}); | |
}; | |
eventEmitter.on('test', function() { testAsync(); }); | |
setInterval(function() { | |
eventEmitter.emit('test'); | |
}, 10); | |
var memoryLogger = require('memory-logger'); | |
memoryLogger.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment