yaopdeprecated

Yet another object pool. There are many like it, but this one is mine.

Usage no npm install needed!

<script type="module">
  import yaop from 'https://cdn.skypack.dev/yaop';
</script>

README

yaop

Yet another object pool. There are many like it, but this one is mine.

Heavily inspired by https://github.com/getify/deePool and is slightly faster.

npm install yaop

Usage

import {createObjectPool} from 'yaop';

const pool = createObjectPool(() => {
  // Create and return a heavy object.
});

// Prepare 100 heavy objects.
pool.allocate(100);

// Take a heavy object from the pool.
const heavyObject = pool.take();

// Return heavy object back to the pool.
pool.release(heavyObject);