forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'nodejs/master' into chakracore-master
Sync to nodejs/master (2016-05-05) at 330ea76 PR-URL: nodejs#69 Reviewed-By: Jianchun Xu <[email protected]>
- Loading branch information
Showing
1,794 changed files
with
581,232 additions
and
32,579 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
Large diffs are not rendered by default.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
const util = require('util'); | ||
const common = require('../common.js'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
v: [1, 2], | ||
n: [1e6] | ||
}); | ||
|
||
function twoDifferentProxies(n) { | ||
// This one should be slower between we're looking up multiple proxies. | ||
const proxyA = new Proxy({}, {get: () => {}}); | ||
const proxyB = new Proxy({}, {get: () => {}}); | ||
bench.start(); | ||
for (var i = 0; i < n; i += 1) | ||
util.inspect({a: proxyA, b: proxyB}, {showProxy: true}); | ||
bench.end(n); | ||
} | ||
|
||
function oneProxy(n) { | ||
// This one should be a bit faster because of the internal caching. | ||
const proxy = new Proxy({}, {get: () => {}}); | ||
bench.start(); | ||
for (var i = 0; i < n; i += 1) | ||
util.inspect({a: proxy, b: proxy}, {showProxy: true}); | ||
bench.end(n); | ||
} | ||
|
||
function main(conf) { | ||
const n = conf.n | 0; | ||
const v = conf.v | 0; | ||
|
||
switch (v) { | ||
case 1: | ||
oneProxy(n); | ||
break; | ||
case 2: | ||
twoDifferentProxies(n); | ||
break; | ||
default: | ||
throw new Error('Should not get to here'); | ||
} | ||
} |
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.