{"name":"typedarray-pool","version":"1.1.0","description":"Reuse typed arrays","main":"pool.js","directories":{"test":"test"},"dependencies":{"bit-twiddle":"^1.0.0","dup":"^1.0.0"},"devDependencies":{"tape":"^2.12.3"},"scripts":{"test":"tape 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","testling":{"files":"test/*.js","browsers":["ie/10..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/6.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"bugs":{"url":"https://github.com/mikolalysenko/typedarray-pool/issues"},"homepage":"https://github.com/mikolalysenko/typedarray-pool","_id":"typedarray-pool@1.1.0","dist":{"shasum":"d114f484801489f53ecab5e8088aa23044f498d9","tarball":"http://registry-npm.ywwl.com/typedarray-pool/download/typedarray-pool-1.1.0.tgz","integrity":"sha512-AQFJWJj8ZqHQoRqX7T/PbJMU0TbYRKYpDhAJu1rtacbg4kBKMUrALOtVQ3cZiFIYlqPFSosH4yEZe8h7ZDfe2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDA5javDkar6vgzdu7mL/8htXe4F0gcUjBY85k2N0UbtAiBRktabdxve1eCpl0+IOI3d+bmTqXhHLkD4zjgO5RKCiA=="}],"size":4011,"noattachment":false,"key":"/typedarray-pool/-/typedarray-pool-1.1.0.tgz"},"_from":".","_npmVersion":"1.4.3","_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":1411855446991,"_cnpm_publish_time":1411855446991,"dist-tags":{"latest":"1.2.0"}}