clayrisser / fastdash

multithreaded utility functions for node using worker threads

Home Page:https://codejam.ninja

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fastdash

GitHub stars

multithreaded utility functions for node using worker threads

Please ★ this repo if you found it useful ★ ★ ★

Features

  • supports typescript
  • customize max threads

Benchmarks

map benchmarks

These benchmarks were performed on a server with 8 cores to show the contrast between multithreaded and single threaded node processing.

A function calculates prime numbers to simulate a workload.

map() CPU Intensive CPU Nonintensive
fastdash 2741.328177 ms 322.372878 ms
lodash 10367.716365 ms 0.271168 ms

fastdash is multithreaded and is faster than lodash for CPU intensive tasks.

Screenshot from 2019-03-26 03-26-49

lodash is single threaded and is slower than fastdash for CPU intensive tasks.

Screenshot from 2019-03-26 03-28-00

lodash is faster than fastdash for tasks that are not CPU intensive.

Installation

npm install --save fastdash

Dependencies

Usage

Iteratee callback functions must be pure functions

map

import fast from 'fastdash';

async main() {
  const result = await fast.map([1, 2, 3], item => {
    return item + 1;
  });
  console.log(result); // [2, 3, 4]
}

main();

Support

Submit an issue

Screenshots

Contribute a screenshot

Contributing

Review the guidelines for contributing

License

MIT License

Jam Risser © 2019

Changelog

Review the changelog

Credits

Support on Liberapay

A ridiculous amount of coffee was consumed in the process of building this project.

Add some fuel if you'd like to keep me going!

Liberapay receiving Liberapay patrons

About

multithreaded utility functions for node using worker threads

https://codejam.ninja

License:MIT License


Languages

Language:TypeScript 100.0%