Thanks to visit codestin.com
Credit goes to github.com

Skip to content

LinusU/fastq

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastq  build status

Fast, in memory work queue.

Benchmarks (1 million tasks):

  • setImmedidate: 1715ms
  • fastq: 1824ms
  • async.queue: 6158ms

Obtained on node 0.12.3, on a HP Spectre 360 (the Build 2015 edition).

If you need zero-overhead series function call, check out fastseries. For zero-overhead parallel function call, check out fastparallel.

js-standard-style

Install

npm i fastq --save

Usage

'use strict'

var queue = require('fastq')(worker, 1)

queue.push(42, function (err, result) {
  if (err) { throw err }
  console.log('the result is', result)
})

function worker (arg, cb) {
  cb(null, 42 * 2)
}

Setting this

'use strict'

var that = { hello: 'world' }
var queue = require('fastq')(that, worker, 1)

queue.push(42, function (err, result) {
  if (err) { throw err }
  console.log(this)
  console.log('the result is', result)
})

function worker (arg, cb) {
  console.log(this)
  cb(null, 42 * 2)
}

License

ISC

About

Fast, in memory work queue

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%