npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

qoll

v0.0.2

Published

Node.JS thread pool.

Readme

Qoll

This is a very lightweight Node.JS thread pool library with no dependencies and a very small runtime. This library minimizes the complexity of creating thread pools and makes multithreaded programming easier and more user-friendly.

Version

0.0.2

Overview

The function is converted to a string, passed in as an eval string to a child thread, and then a thread pool is created based on the specified number of threads, which the user can define or default to CPU threads if not defined, and the data is passed in through workerData to the child thread. Whenever a user wakes up a thread, the poll function is called and the result is returned to the caller of wake. When a task enters the thread pool, the behavior of scheduling is that if there are free threads, the task is assigned to the free thread. If there are no free threads in the thread pool, the task is put in a wait queue, waiting for the thread pool to be free and then assigned to the free thread pool again.

The way the library works depends on serializing the function to a string and then transferring it to a child thread, so the scope of the child thread function is completely isolated and the function cannot access the outside of the scope.

Quick start

You need to install this library into your project through npm first:

npm install qoll

Then introduce this library into your project:

// Export runtime and default thread count
const {Runtime, DefaultPools} = require("qoll")

Then we start creating thread pools:

const threads = Runtime.spawn(DefaultPools, {
    
    // Sharing data across threads
    mutex: {
        sum: 0
    },
    
    // Independent data for child threads
    data: {
        index: 0
    },
    
    /**
     * Called when a thread is created, 
     * this is private data,
     * I'm going to add the sleep function to this.
     */
    initialize() {
        this.sleep = function(timeout) {
            return new Promise(resolve => {
                setTimeout(resolve, timeout)
            })
        }
    },
    
    /**
     * Called each time a task executes,
     * this is private data,
     * here we simulate a CPU-intensive computing task.
     */
    async poll(param) {
        await this.sleep(2000)
        let { sum } = await this.mutex.lock()
        await this.mutex.unlock({ sum: sum + param.number })
        this.index += param.index
        return {
            index: this.index,
            sum
        }
    }
})

After the thread pool is created, we will wake up the thread pool with batch creation task and output the callback result:

/**
 * Create 99 tasks to pass to the thread pool,
 * print out the data returned each time.
 */
for (let index = 0; index < 99; index ++) {
    threads
        .wake({index, number: 1})
        .then(console.log)  
}

The full example is here.

License

MIT Copyright (c) 2020 Mr.Panda.