TypedArray pool
A global pool for typed arrays (923 B).
This library is a modern TypeScript port of the original typedarray-pool library by Mikola Lysenko with some API changes.
Installation
Make sure you have Node.js installed.
$ npm install @timvanscherpenzeel/typedarray-pool
Usage
import { TypedArrayPool } from '@timvanscherpenzeel/typedarray-pool';
const typedArrayPool = new TypedArrayPool();
// Allocate a buffer with at least 128 floats
const f = typedArrayPool.malloc(128, 'FLOAT_32');
// ...
// When done, release buffer back to pool
typedArrayPool.free(f);
Development
$ yarn start
$ yarn lint
$ yarn test
$ yarn build
Licence
My work is released under the MIT license.