clusterprocess

1.0.1 • Public • Published

clusterprocess

Process an array on different clusters

NPM

Example

var clusterprocess = require('./index.js');
 
var start = new Date().getTime();
 
var options = {
    'getData': function(cb) {
        var data = [];
        for(var i = 0; i < 10; i++){
            data.push(i);
        }
        cb(data);
    },
    'nbWorker': 2,
    'process': function(i, d, cb) {
        console.log('process ' + d);
        return cb(* 2);
    },
    'done': function(result) {
        console.log(result);
        console.log(((new Date().getTime()) - start) / 1000);
        process.exit();
    }
};
 
new clusterprocess(options);
 
//1 : 0.429
//2 : 0.324
//3 : 0.245

Dependencies

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i clusterprocess

    Weekly Downloads

    2

    Version

    1.0.1

    License

    ISC

    Last publish

    Collaborators

    • anrry