All Projects β†’ Aslemammad β†’ tinypool

Aslemammad / tinypool

Licence: other
🧡 A minimal and tiny Node.js Worker Thread Pool implementation (38KB)

Projects that are alternatives of or similar to tinypool

Minimp3
Minimalistic MP3 decoder single header library
Stars: ✭ 898 (+98.67%)
Mutual labels:  minimal, tiny
Domvm
DOM ViewModel - A thin, fast, dependency-free vdom view layer
Stars: ✭ 581 (+28.54%)
Mutual labels:  fast, minimal
Webpack Nano
A teensy, squeaky 🐀 clean Webpack CLI
Stars: ✭ 199 (-55.97%)
Mutual labels:  minimal, tiny
kolorist
A tiny utility to colorize stdin/stdout
Stars: ✭ 160 (-64.6%)
Mutual labels:  minimal, tiny
Kross Hugo
Kross Creative Portfolio Template
Stars: ✭ 172 (-61.95%)
Mutual labels:  fast, minimal
tiny-framework
A light wight easy to use RESTful apis framework for education & demo purposes. stripped down framework to the fundamental components that that every one would essentially need to (learn / make a demo application).
Stars: ✭ 13 (-97.12%)
Mutual labels:  minimal, tiny
wymlp
tiny fast portable real-time deep neural network for regression and classification within 50 LOC.
Stars: ✭ 36 (-92.04%)
Mutual labels:  fast, tiny
SSTMCSPGAAS
Stupidly Simple Tiny Minimal Coming Soon Page Generator As A Service
Stars: ✭ 23 (-94.91%)
Mutual labels:  minimal, tiny
Dot Hugo Documentation Theme
Dot - Hugo Documentation Theme
Stars: ✭ 162 (-64.16%)
Mutual labels:  fast, minimal
Shelby
Shelby is a fast ⚑️ , lightweight ☁️ , minimal✨, shell prompt written in Go.
Stars: ✭ 148 (-67.26%)
Mutual labels:  fast, minimal
natural
Fastest Framework for NodeJS. Written in pure ES6+
Stars: ✭ 30 (-93.36%)
Mutual labels:  fast, workers
pixie
Tiny template functions.
Stars: ✭ 14 (-96.9%)
Mutual labels:  fast, tiny
Derrick
πŸ™Œ Derrick is a clean minimal and fast theme for a personal blog.
Stars: ✭ 51 (-88.72%)
Mutual labels:  fast, minimal
Sifrr
⚑️ Set of tiny, independent libraries for creating modern and fast webapps with javascript/typescript
Stars: ✭ 174 (-61.5%)
Mutual labels:  fast, minimal
ByteCopy
Simple C99 program and API for copying files.
Stars: ✭ 16 (-96.46%)
Mutual labels:  fast, minimal
pool
Go library that wraps http.Client to provide seamless higher-level connection pooling features
Stars: ✭ 39 (-91.37%)
Mutual labels:  pooling
DevFolio
A Modern Portfolio Template for Developers with easy setup process documented(with hosting).
Stars: ✭ 96 (-78.76%)
Mutual labels:  minimal
rqmonitor
Flask based more dynamic and actionable frontend dashboard for monitoring Redis Queue πŸ‘©πŸΏβ€πŸ’» http://python-rq.org
Stars: ✭ 152 (-66.37%)
Mutual labels:  workers
eec
A fast and lower memory excel write/read tool.δΈ€δΈͺ非POIεΊ•ε±‚οΌŒζ”―ζŒζ΅εΌε€„η†ηš„ι«˜ζ•ˆδΈ”θΆ…δ½Žε†…ε­˜ηš„Excel读写ε·₯ε…·
Stars: ✭ 93 (-79.42%)
Mutual labels:  fast
air
A hyper-minimal WordPress starter theme for developers built with Tailwind CSS.
Stars: ✭ 45 (-90.04%)
Mutual labels:  minimal

Tinypool - the node.js worker pool 🧡

Piscina: A fast, efficient Node.js Worker Thread Pool implementation

Tinypool is a fork of piscina. What we try to achieve in this library, is to eliminate some dependencies and features that our target users don't need (currently, our main user will be Vitest). Tinypool's install size (38KB) can then be smaller than Piscina's install size (6MB). If you need features like utilization or NAPI, Piscina is a better choice for you. We think that Piscina is an amazing library, and we may try to upstream some of the dependencies optimization in this fork.

  • βœ… Smaller install size, 38KB

  • βœ… Minimal

  • βœ… No dependencies

  • βœ… Physical cores instead of Logical cores with physical-cpu-count

  • ❌ No utilization

  • ❌ No NAPI

  • Written in TypeScript, and ESM support only. For Node.js 14.x and higher.

In case you need more tiny libraries like tinypool or tinyspy, please consider submitting an RFC

Example

In main.js:

import path from 'path'
import Tinypool from 'tinypool'

const pool = new Tinypool({
  filename: new URL('./worker.js', import.meta.url).href,
})

;(async function () {
  const result = await pool.run({ a: 4, b: 6 })
  console.log(result) // Prints 10
})()

In worker.js:

export default ({ a, b }) => {
  return a + b
}

API

We have a similar API to Piscina, so for more information, you can read Piscina's detailed documentation and apply the same techniques here.

Additional Options
  • isolateWorkers: Default to false. Always starts with a fresh worker when running tasks to isolate the environment.
  • workerId: Each worker now has an id ( <= maxThreads) that can be imported from tinypool in the worker itself (or process.__tinypool_state__.workerId)

Authors


Mohammad Bagher

Credits

The Vitest team for giving me the chance of creating and maintaing this project for vitest.

Piscina, because Tinypool is not more than a friendly fork of piscina.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].