A high-performance BitPool implementation backed by Uint32Array for efficient memory usage and fast bitwise operations.
See jsr.io/@phughesmcr/bitpool for complete documentation.
npx jsr add @phughesmcr/bitpool
import { BitPool } from "@phughesmcr/bitpool";
deno add jsr:@phughesmcr/bitpool
import { BitPool } from "@phughesmcr/bitpool";
bunx jsr add @phughesmcr/bitpool
import { BitPool } from "@phughesmcr/bitpool";
deno task example
will run a complete example.
const pool = new BitPool(1000); // 0 - 999 const entity_1 = pool.acquire(); const entity_2 = pool.acquire(); console.log(pool.isOccupied(entity_1)); console.log(pool.isOccupied(entity_2)); console.log(pool.isOccupied(999)); pool.release(entity_1); pool.release(entity_2); console.log(pool.isOccupied(entity_1)); console.log(pool.isOccupied(entity_2)); console.log(pool.isOccupied(999));
Contributions are welcome. The aim of the project is performance - both in terms of speed and GC allocation pressure.
Please run deno test
and deno task prep
to run the tests before committing.
BitPool is released under the MIT license. See LICENSE
for further details.
© 2024 The BitPool Authors. All rights reserved.
See AUTHORS.md
for author details.
Add Package
deno add jsr:@phughesmcr/bitpool
Import symbol
import * as bitpool from "@phughesmcr/bitpool";
---- OR ----
Import directly with a jsr specifier
import * as bitpool from "jsr:@phughesmcr/bitpool";
Add Package
npx jsr add @phughesmcr/bitpool
Import symbol
import * as bitpool from "@phughesmcr/bitpool";
Add Package
yarn dlx jsr add @phughesmcr/bitpool
Import symbol
import * as bitpool from "@phughesmcr/bitpool";
Add Package
pnpm dlx jsr add @phughesmcr/bitpool
Import symbol
import * as bitpool from "@phughesmcr/bitpool";
Add Package
bunx jsr add @phughesmcr/bitpool
Import symbol
import * as bitpool from "@phughesmcr/bitpool";