-
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.
Removed as-function overload for Reader/Writer, profiler stub, optimi…
…zed version of Reader#int32
- Loading branch information
Showing
17 changed files
with
141 additions
and
180 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
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,29 @@ | ||
var fs = require("fs"), | ||
path = require("path"); | ||
var protobuf = require(".."); | ||
|
||
// A profiling stub to measure just raw encoding / decoding performance using benchmark data. | ||
|
||
var root = protobuf.parse(fs.readFileSync(require.resolve("../bench/bench.proto")).toString("utf8")).root; | ||
var Test = root.lookup("Test"); | ||
var data = data = require("../bench/bench.json"); | ||
|
||
var count = process.argv.length > 3 && parseInt(process.argv[3]) || 10000000; | ||
|
||
var r = protobuf.Reader.create(new Buffer(0)); | ||
|
||
switch (process.argv[2]) { | ||
default: | ||
console.log("usage: " + path.basename(process.argv[1]) + " <encode|decode> [iterations=10000000]"); | ||
process.exit(1); | ||
return; | ||
case "encode": | ||
for (var i = 0; i < count; ++i) | ||
Test.encode(data).finish(); | ||
break; | ||
case "decode": | ||
var buf = Test.encode(data).finish(); | ||
for (var i = 0; i < count; ++i) | ||
Test.decode(buf); | ||
break; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.