-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process huge strings in chunks, see #555; Run bench in tests for a wh…
…ile; Raw alloc benchmark
- Loading branch information
Showing
21 changed files
with
477 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,10 @@ node_js: | |
- 6 | ||
- 7 | ||
|
||
script: | ||
- npm test | ||
- npm run bench | ||
|
||
branches: | ||
only: | ||
- master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var protobuf = require(".."), | ||
newSuite = require("./suite"); | ||
|
||
var pool = require("../src/util/pool"), | ||
poolAlloc = pool(function(size) { | ||
return new Uint8Array(size); | ||
}, Uint8Array.prototype.subarray); | ||
|
||
[ | ||
64, | ||
256, | ||
1024 | ||
] | ||
.forEach(function(size) { | ||
|
||
newSuite("buffer[" + size + "]") | ||
.add("new Uint8Array", function() { | ||
var buf = new Uint8Array(size); | ||
}) | ||
.add("Buffer.alloc", function() { | ||
var buf = Buffer.alloc(size); | ||
}) | ||
.add("poolAlloc<Uint8Array>", function() { | ||
var buf = poolAlloc(size); | ||
}) | ||
.add("Buffer.allocUnsafe", function() { | ||
var buf = Buffer.allocUnsafe(size); | ||
}) | ||
.add("new Buffer", function() { | ||
var buf = new Buffer(size); | ||
}) | ||
.run(); | ||
|
||
var ab = new ArrayBuffer(size); | ||
|
||
newSuite("wrap[" + size + "]") | ||
.add("new Uint8Array(ArrayBuffer)", function() { | ||
var buf = new Uint8Array(ab); | ||
}) | ||
.add("Buffer.from(ArrayBuffer)", function() { | ||
var buf = Buffer.from(ab); | ||
}) | ||
.run(); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.