queue-buffer
Advanced tools
+3
-0
@@ -0,1 +1,4 @@ | ||
| ### v0.2.0 | ||
| - adapt for io.js 3.0.0 | ||
| ### v0.1.6 | ||
@@ -2,0 +5,0 @@ - decrease default AUTO_RELEASE_THRESHOLD |
+5
-4
| "use strict"; | ||
| var FlexBuffer, QueueBuffer, QueueDelayError, QueueReadError, _readerBuilder, k, ref, ref1, v, write, | ||
| var BufferKeys, FlexBuffer, QueueBuffer, QueueDelayError, QueueReadError, _readerBuilder, i, k, len1, ref, v, write, | ||
| extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
@@ -122,6 +122,7 @@ hasProp = {}.hasOwnProperty; | ||
| }; | ||
| ref1 = Buffer.prototype; | ||
| for (k in ref1) { | ||
| v = ref1[k]; | ||
| BufferKeys = Object.keys(Buffer.prototype); | ||
| for (i = 0, len1 = BufferKeys.length; i < len1; i++) { | ||
| k = BufferKeys[i]; | ||
| if (k.indexOf('read') === 0) { | ||
| v = Buffer.prototype[k]; | ||
| (function(k, v) { | ||
@@ -128,0 +129,0 @@ var arr; |
+11
-9
| { | ||
| "name": "queue-buffer", | ||
| "version": "0.1.6", | ||
| "version": "0.2.0", | ||
| "description": "A flex buffer which behaves as a dynamic queue with a complete but limited Buffer API.", | ||
@@ -18,7 +18,7 @@ "main": "dist/index.js", | ||
| "coffee-script": "*", | ||
| "coffeelint": "1.9.7", | ||
| "coffeelint": "1.10.1", | ||
| "dracupid-no": "git+https://github.com/dracupid/dracupid-no.git", | ||
| "mocha": "^2.2.5", | ||
| "nodoc": "^0.2.4", | ||
| "nokit": "0.7.6" | ||
| "nodoc": "^0.3.5", | ||
| "nokit": "0.10.0" | ||
| }, | ||
@@ -30,17 +30,19 @@ "directories": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/dracupid/flex-buffer.git" | ||
| "url": "git+https://github.com/dracupid/queue-buffer.git" | ||
| }, | ||
| "keywords": [ | ||
| "flex", | ||
| "queue", | ||
| "buffer", | ||
| "resize", | ||
| "auto" | ||
| "auto", | ||
| "release" | ||
| ], | ||
| "bugs": { | ||
| "url": "https://github.com/dracupid/flex-buffer/issues" | ||
| "url": "https://github.com/dracupid/queue-buffer/issues" | ||
| }, | ||
| "homepage": "https://github.com/dracupid/flex-buffer#readme", | ||
| "homepage": "https://github.com/dracupid/queue-buffer#readme", | ||
| "dependencies": { | ||
| "flex-buffer": "^0.4.3" | ||
| "flex-buffer": "^0.5.0" | ||
| } | ||
| } |
+48
-36
@@ -32,76 +32,76 @@ Queue-Buffer | ||
| - #### <a href="./src/index.coffee?source#L12" target="_blank"><b>QueueBuffer.AUTO\_RELEASE_THRESHOLD</b></a> | ||
| Auto release threshold(ms) | ||
| - #### <a href="./src/index.coffee?source#L12" target="_blank"><b>QueueBuffer.AUTO\_RELEASE_THRESHOLD </b></a> | ||
| Auto release threshold(ms) | ||
| - **<u>type</u>**: { _number_ } | ||
| - **type**: { _number_ } | ||
| - #### <a href="./src/index.coffee?source#L21" target="_blank"><b>constructor(arg, opts = {})</b></a> | ||
| see [FlexBuffer](https://github.com/dracupid/flex-buffer#constructorarg-opts--) | ||
| - #### <a href="./src/index.coffee?source#L21" target="_blank"><b>constructor (arg, opts = {})</b></a> | ||
| see [FlexBuffer](https://github.com/dracupid/flex-buffer#constructorarg-opts--) | ||
| - **<u>param</u>**: `arg` { _number | Buffer | Array | string_ } | ||
| - **param**: `arg` { _number | Buffer | Array | string_ } | ||
| The same arg as Buffer. | ||
| - **<u>param</u>**: `opts` { _Object={}_ } | ||
| - **param**: `opts` { _Object={}_ } | ||
| options | ||
| - **<u>option</u>**: `autoRelease` { _boolean_ } | ||
| - **option**: `autoRelease` { _boolean_ } | ||
| auto release useless space | ||
| - **<u>option</u>**: `autoReleaseThreshold` { _number_ } | ||
| - **option**: `autoReleaseThreshold` { _number_ } | ||
| auto release threshold(ms) | ||
| - #### <a href="./src/index.coffee?source#L33" target="_blank"><b>free()</b></a> | ||
| Release useless space which has been read. | ||
| - #### <a href="./src/index.coffee?source#L33" target="_blank"><b>free ()</b></a> | ||
| Release useless space which has been read. | ||
| - #### <a href="./src/index.coffee?source#L80" target="_blank"><b>move(size)</b></a> | ||
| Move current read offset. | ||
| - #### <a href="./src/index.coffee?source#L80" target="_blank"><b>move (size)</b></a> | ||
| Move current read offset. | ||
| - **<u>param</u>**: `size` { _number_ } | ||
| - **param**: `size` { _number_ } | ||
| number of bytes to move, can be negative. | ||
| - #### <a href="./src/index.coffee?source#L90" target="_blank"><b>skip(size)</b></a> | ||
| Move current read offset forward. | ||
| - #### <a href="./src/index.coffee?source#L90" target="_blank"><b>skip (size)</b></a> | ||
| Move current read offset forward. | ||
| - **<u>param</u>**: `size` { _number_ } | ||
| - **param**: `size` { _number_ } | ||
| number of bytes to skip | ||
| - #### <a href="./src/index.coffee?source#L100" target="_blank"><b>rewind(size)</b></a> | ||
| Move current read offset backward. | ||
| - #### <a href="./src/index.coffee?source#L100" target="_blank"><b>rewind (size)</b></a> | ||
| Move current read offset backward. | ||
| - **<u>param</u>**: `size` { _number_ } | ||
| - **param**: `size` { _number_ } | ||
| number of bytes to rewind | ||
| - #### <a href="./src/index.coffee?source#L122" target="_blank"><b>read(size) (alias: unshift, dequeue) </b></a> | ||
| Read bytes from the head of the buffer. | ||
| - #### <a href="./src/index.coffee?source#L122" target="_blank"><b>read (size) <small>(alias: unshift, dequeue)</small> </b></a> | ||
| Read bytes from the head of the buffer. | ||
| - **<u>param</u>**: `size` { _number_ } | ||
| - **param**: `size` { _number_ } | ||
| number of bytes to read | ||
| - **<u>return</u>**: { _Buffer_ } | ||
| - **return**: { _Buffer_ } | ||
| data | ||
| - #### <a href="./src/index.coffee?source#L146" target="_blank"><b>write(value, encoding = "utf8") (alias: push, enqueue) </b></a> | ||
| see [FlexBuffer](https://github.com/dracupid/flex-buffer#writevalue-encoding--utf8) | ||
| - #### <a href="./src/index.coffee?source#L146" target="_blank"><b>write (value, encoding = "utf8") <small>(alias: push, enqueue)</small> </b></a> | ||
| see [FlexBuffer](https://github.com/dracupid/flex-buffer#writevalue-encoding--utf8) | ||
| - **<u>param</u>**: `value` { _number | string | Array | Buffer_ } | ||
| - **param**: `value` { _number | string | Array | Buffer_ } | ||
| The value to write | ||
| - **<u>param</u>**: `encoding` { _string="utf8"_ } | ||
| - **param**: `encoding` { _string="utf8"_ } | ||
| string encoding | ||
| - #### <a href="./src/index.coffee?source#L154" target="_blank"><b>length</b></a> | ||
| length of the data | ||
| - #### <a href="./src/index.coffee?source#L154" target="_blank"><b>length </b></a> | ||
| length of the data | ||
| - **<u>type</u>**: { _number_ } | ||
| - **type**: { _number_ } | ||
@@ -121,13 +121,25 @@ | ||
| ``` | ||
| Environment: io.js v2.0.0, OS X 10.10.2, Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
| Environment: OS X 10.10.4, Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
| **io.js v2.4.0** | ||
| - Read | ||
| - Buffer x 710,928 ops/sec ±0.40% (91 runs sampled) | ||
| - FlexBuffer x 687,658 ops/sec ±1.44% (90 runs sampled) | ||
| - Buffer x 721,399 ops/sec ±0.52% (93 runs sampled) | ||
| - FlexBuffer x 656,232 ops/sec ±0.87% (90 runs sampled) | ||
| - wrapped native API | ||
| - Buffer x 20,815,938 ops/sec ±0.59% (94 runs sampled) | ||
| - FlexBuffer x 14,698,706 ops/sec ±0.84% (93 runs sampled) | ||
| - Buffer x 17,708,521 ops/sec ±0.72% (93 runs sampled) | ||
| - FlexBuffer x 12,937,044 ops/sec ±0.70% (91 runs sampled) | ||
| **io.js v3.0.0** | ||
| > see https://github.com/dracupid/flex-buffer#benchmark for more info | ||
| - Read | ||
| - Buffer x 323,664 ops/sec ±0.68% (91 runs sampled) | ||
| - FlexBuffer x 320,600 ops/sec ±0.75% (93 runs sampled) | ||
| - wrapped native API | ||
| - Buffer x 9,614,392 ops/sec ±0.70% (92 runs sampled) | ||
| - FlexBuffer x 7,115,334 ops/sec ±0.68% (93 runs sampled) | ||
| ## License | ||
| MIT@Jingchen Zhao |
13384
3.94%176
0.57%144
9.09%+ Added
- Removed
Updated