Skip to content

Releases: henrygd/queue

v1.2.0

Choose a tag to compare

@henrygd henrygd released this 20 Nov 19:23

Features

  • Time-based rate limiting: Added @henrygd/queue/rl export. You can now limit how many tasks start within a specific time window in addition to concurrency. (#3)
import { newQueue } from '@henrygd/queue/rl'

// 10 concurrent tasks max, but only 3 can start per second
const queue = newQueue(10, 3, 1000)

Bug Fixes

  • Fix clear() hanging: clear() now rejects all pending promises with a Queue cleared error. Previously, pending promises were silently removed, causing queue.all() to hang. (#4)

Full Changelog: v1.1.0...v1.2.0

v1.1.0

Choose a tag to compare

@henrygd henrygd released this 11 Oct 16:21

Adds queue.all for Promise.all-like behavior with concurrency control (#2)

Full Changelog: v1.0.7...v1.1.0

v1.0.7

Choose a tag to compare

@henrygd henrygd released this 17 Oct 22:32

Exports Queue interface to prevent "is using name 'Queue' from external module" TypeScript error

Full Changelog: v1.0.6...v1.0.7

v1.0.6

Choose a tag to compare

@henrygd henrygd released this 26 Jun 21:44

Performance improvements in V8

Full Changelog: v1.0.5...v1.0.6

v1.0.5

Choose a tag to compare

@henrygd henrygd released this 24 Jun 23:13

Updates

  • Improved performance

Notes

Benchmark tests have been changed so that every library uses the exact same test.

promise-queue and p-limit don't provide a promise that resolves when the queue is empty, so I was using Promise.all with an array of jobs. Which is how you use them in real life. But it's a slight performance hit and I don't want the tests to be different.

The updated results are in the readme.

Full Changelog: v1.0.4...v1.0.5

v1.0.4

Choose a tag to compare

@henrygd henrygd released this 18 Jun 20:27

Adds CommonJS modules

Full Changelog: v1.0.3...v1.0.4

v1.0.3

Choose a tag to compare

@henrygd henrygd released this 15 Jun 23:22

No new features or fixes. Just refactoring and adding new benchmarks like this one:

Cloudflare Workers benchmark

Library Requests/sec Total (sec) Average Slowest
@henrygd/queue 622.7809 1.6057 0.0786 0.1155
promise-queue 324.8053 3.0788 0.1512 0.2174
async.queue 203.9315 4.9036 0.2408 0.3450
fastq 184.0524 5.4332 0.2670 0.3546
queue 86.4867 11.5625 0.5672 0.7636
p-limit 67.5275 14.8088 0.7274 1.0657

Full Changelog: v1.0.2...v1.0.3

v1.0.2

Choose a tag to compare

@henrygd henrygd released this 15 Jun 02:53
  • queue.done can now be invoked in different contexts simultaneously
  • General refactoring. Library is now at 332 bytes :)
  • Added fastq and async.queue to the benchmark

Full Changelog: v1.0.1...v1.0.2

@henrygd/queue - 9,905 Ops/s. promise-queue - 5,335 Ops/s. fastq - 4,270 Ops/s. async.queue - 3,811 Ops/s. p-limit - 1,000 Ops/s. queue - 686 Ops/s

v1.0.1

Choose a tag to compare

@henrygd henrygd released this 14 Jun 03:26

Updates

  • Add support for AsyncLocalStorage
  • Refactor queue.done() implementation. Bundle now down to 342 bytes. :)
  • Update benchmarks

Full Changelog: v1.0.0...v1.0.1

v1.0.0

Choose a tag to compare

@henrygd henrygd released this 12 Jun 03:06

Updates

  • add done method which returns a promise that resolves when the queue is empty
  • add clear method to empty the queue
  • add size method to get the total number of promises in the queue
  • add active method to get the number of promises currently running

Benchmark

Average of five runs passing Promise.resolve() through the same queue one million times on a Ryzen 7 6800H laptop using Bun 1.1.12.

p-limit is used for comparison because it's the most popular comparable library, with 117 million weekly downloads (!) as of June 2024. I've used it before and it's great.

Also included is the minified bundle size (no gzip) for reference.

Library Version Time (ms) Heap size (MB) Bundle size (B)
@henrygd/queue 1.0.0 512 37.4 352
p-limit 5.0.0 2,276 223.3 1,763

Full Changelog: v0.0.2...v1.0.0