{"name":"typedarray-pool","version":"0.1.0","description":"Reuse typed arrays","main":"pool.js","directories":{"test":"test"},"dependencies":{"bit-twiddle":"~0.0.2","dup":"~0.0.0"},"devDependencies":{"tap":"~0.4.2"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/typedarray-pool.git"},"keywords":["typed","array","cache","pool","memory","malloc","free","reuse","optimize","construct","overhead"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"d7a8a448caf51042e6c371b11074aab6ebaf53ad","_id":"typedarray-pool@0.1.0","dist":{"shasum":"f211afda2ab6818a84fc6b279a94872639a5e988","tarball":"http://registry-npm.ywwl.com/typedarray-pool/download/typedarray-pool-0.1.0.tgz","integrity":"sha512-moPRU7noaffvngYljYeQeleYJMJaojNe4oXYNZnicgPm3mWjjsrIOpV8fY4yuqX3UrZsyewtJcI7S+0YdREWow==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSZZay1R2NqkUslPKzo69+cwty7DdhQr0UfQifZ0e6uwIgazw1uunxl5Xko+BfY9crz+pjPzCDwN5qU4kCF7W0N+M="}],"size":3938,"noattachment":false,"key":"/typedarray-pool/-/typedarray-pool-0.1.0.tgz"},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"readme":"typedarray-pool\n===============\nA global pool for typed arrays.\n\n[![testling badge](https://ci.testling.com/mikolalysenko/typedarray-pool.png)](https://ci.testling.com/mikolalysenko/typedarray-pool)\n\n[![build status](https://secure.travis-ci.org/mikolalysenko/typedarray-pool.png)](http://travis-ci.org/mikolalysenko/typedarray-pool)\n\n# Example\n\n```javascript\nvar pool = require(\"typedarray-pool\")\n\n//Allocate a buffer with at least 128 floats\nvar f = pool.malloc(128, \"float\")\n\n// ... do stuff ...\n\n//When done, release buffer\npool.free(f)\n```\n\n# Install\n\n    npm install typedarray-pool\n\n# API\n\n```javascript\nvar pool = require(\"typedarray-pool\")\n```\n\n### `pool.malloc(n[, dtype])`\nAllocates a typed array (or ArrayBuffer) with at least n elements.\n\n* `n` is the number of elements in the array\n* `dtype` is the data type of the array to allocate.  Must be one of:\n\n  + `\"uint8\"`\n  + `\"uint16\"`\n  + `\"uint32\"`\n  + `\"int8\"`\n  + `\"int16\"`\n  + `\"int32\"`\n  + `\"float\"`\n  + `\"float32\"`\n  + `\"double\"`\n  + `\"float64\"`\n  + `\"arraybuffer\"`\n  + `\"data\"`\n  + `\"uint8_clamped\"`\n  + `\"bigint64\"`\n  + `\"biguint64\"`\n  + `\"buffer\"`\n\n**Returns** A typed array with at least `n` elements in it.  If `dtype` is undefined, an ArrayBuffer is returned.\n\n**Note**  You can avoid the dispatch by directly calling one of the following methods:\n\n* `pool.mallocUint8`\n* `pool.mallocUint16`\n* `pool.mallocUint32`\n* `pool.mallocInt8`\n* `pool.mallocInt16`\n* `pool.mallocInt32`\n* `pool.mallocFloat`\n* `pool.mallocDouble`\n* `pool.mallocArrayBuffer`\n* `pool.mallocDataView`\n* `pool.mallocUint8Clamped`\n* `pool.mallocBigInt64`\n* `pool.mallocBigUint64`\n* `pool.mallocBuffer`\n\n### `pool.free(array)`\nReturns the array back to the pool.\n\n* `array` The array object to return to the pool.\n\n**Note** You can speed up the method if you know the type of array before hand by calling one of the following:\n\n* `pool.freeUint8`\n* `pool.freeUint16`\n* `pool.freeUint32`\n* `pool.freeInt8`\n* `pool.freeInt16`\n* `pool.freeInt32`\n* `pool.freeFloat`\n* `pool.freeDouble`\n* `pool.freeArrayBuffer`\n* `pool.freeDataView`\n* `pool.freeUint8Clamped`\n* `pool.freeBigInt64`\n* `pool.freeBigUint64`\n* `pool.freeBuffer`\n\n### `pool.clearCache()`\nRemoves all references to cached arrays.  Use this when you are done with the pool to return all the cached memory to the garbage collector.\n\n# Credits\n(c) 2014 Mikola Lysenko. MIT License\n","publish_time":1368498326644,"_cnpm_publish_time":1368498326644,"dist-tags":{"latest":"1.2.0"}}