Skip to content

Commit

Permalink
Other: Fixed some common reflection deopt sites, see #653
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jan 24, 2017
1 parent cdfe6bf commit 3317a76
Show file tree
Hide file tree
Showing 31 changed files with 1,898 additions and 248 deletions.
21 changes: 15 additions & 6 deletions bench/prof.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,21 @@ var protobuf = require("..");

// protobuf.util.codegen.verbose = true;

var root, Test, data, count;
var root, json;

if (process.argv[2] === "fromjson") {
json = require("../tests/data/test.json");
if (process.argv.indexOf("--resolve") < 0)
for (var k = 0; k < 10000; ++k)
protobuf.Root.fromJSON(json);
else
for (var l = 0; l < 10000; ++l)
protobuf.Root.fromJSON(json).resolveAll();
return;
}

var Test, data, count;

if (process.argv.indexOf("--alt") < 0) {
root = protobuf.parse(fs.readFileSync(require.resolve("../bench/bench.proto")).toString("utf8")).root;
Test = root.lookup("Test");
Expand All @@ -59,7 +73,6 @@ if (process.argv.indexOf("--alt") < 0) {
count = 1000;
process.stdout.write("vector_tile.proto");
}
var json = JSON.stringify(root);

if (process.argv.length > 3 && /^\d+$/.test(process.argv[3]))
count = parseInt(process.argv[3], 10);
Expand All @@ -86,8 +99,4 @@ switch (process.argv[2]) {
for (var j = 0; j < count; ++j)
Test.decode(buf);
break;
case "fromjson":
for (var k = 0; k < 100000000; ++k)
protobuf.Root.fromJSON(json).resolveAll();
break;
}
Loading

0 comments on commit 3317a76

Please sign in to comment.