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

aipooljs

v0.5.9

Published

Tiny, strict object pool for high-frequency acquire/release patterns — PixiJS sprite pools, bullet pools, particle pools, DOM node recyclers, worker job slots. Fixed-size, fail-fast on overflow, double-release detection.

Readme

aipooljs

Tiny strict object pool for hot acquire/release paths: sprites, bullets, particles, DOM nodes, and worker slots.

Status: 0.5.9 - stable 1.0-track surface. The root entry is the public API.

Install

pnpm add aipooljs
import { createPool } from "aipooljs";

Quick Start

const bullets = createPool({
  size: 256,
  create: () => ({ x: 0, y: 0, active: false }),
  reset: (b) => {
    b.x = 0;
    b.y = 0;
    b.active = false;
  },
});

const bullet = bullets.acquire();
bullet.active = true;
bullets.release(bullet);

await bullets.borrow(async (slot) => {
  slot.active = true;
});

bullets.dispose();

Core API

  • createPool({ size, create, reset, onOverflow? }) builds a fixed-size pool.
  • pool.acquire() returns a live slot or follows onOverflow.
  • pool.release(obj) resets and returns a live slot.
  • pool.drain() releases all currently live slots.
  • pool.borrow(fn, { signal }?) acquires, runs fn, and releases in finally.
  • pool.dispose() is idempotent permanent teardown.
  • Read-only state: available, alive, disposed.
  • Errors: PoolError, PoolDisposedError.

Overflow Strategies

| Strategy | Behavior | | --- | --- | | "throw" | Default; throws PoolError when empty. | | "null" | acquire() returns null; factory overload narrows the pool type. | | "grow" | Allocates more objects and doubles capacity; can cause same-frame GC spikes. | | function | Escape hatch. The handler returns a slot and is responsible for avoiding aliasing/recursion. |

Sharp Edges

  • Function overflow handlers can return an already-live object. That aliases the previous holder and can make later release() calls throw.
  • If reset() throws, the slot is removed from alive before it returns to available, so capacity shrinks permanently for that object.
  • borrow() only takes the async branch when fn returns a native Promise. Non-instanceof Promise thenables are treated as sync: the slot is released immediately and the thenable is returned as-is. Prefer real Promises.
  • Aborting borrow() releases the slot but does not stop inner work. If the pool is disposed during async borrow, the result is reported through the disposed path.
  • Do not delete fields in reset() on hot objects; assign default values to preserve hidden classes.

AI Context

License

MIT