Commit 02ce935a authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Implement micro-benchmark for Proxies constructor

Bug: 
Change-Id: I95285260b0848c4c876498bfef0b13ffbe6855ad
Reviewed-on: https://chromium-review.googlesource.com/558297Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Maya Lekova <mslekova@google.com>
Cr-Commit-Position: refs/heads/master@{#46415}
parent 53d68701
......@@ -8,6 +8,19 @@
"total": true,
"resources": ["base.js"],
"tests": [
{
"name": "Proxies",
"path": ["Proxies"],
"main": "run.js",
"resources": ["proxies.js"],
"results_regexp": "^%s\\-Proxies\\(Score\\): (.+)$",
"tests": [
{"name": "ProxyConstructorWithArrowFunc"},
{"name": "ProxyConstructorWithClass"},
{"name": "ProxyConstructorWithObject"},
{"name": "ProxyConstructorWithProxy"}
]
},
{
"name": "AsyncAwait",
"path": ["AsyncAwait"],
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function newBenchmark(name, handlers) {
new BenchmarkSuite(name, [1000], [
new Benchmark(name, false, false, 0,
handlers.run, handlers.setup, handlers.teardown)
]);
}
// ----------------------------------------------------------------------------
var result;
var foo = () => {}
newBenchmark("ProxyConstructorWithArrowFunc", {
setup() { },
run() {
var proxy = new Proxy(foo, {});
result = proxy;
},
teardown() {
return (typeof result == 'function');
}
});
// ----------------------------------------------------------------------------
class Class {};
newBenchmark("ProxyConstructorWithClass", {
setup() { },
run() {
var proxy = new Proxy(Class, {});
result = proxy;
},
teardown() {
return (typeof result == 'function');
}
});
// ----------------------------------------------------------------------------
var obj = {};
newBenchmark("ProxyConstructorWithObject", {
setup() { },
run() {
var proxy = new Proxy(obj, {});
result = proxy;
},
teardown() {
return (typeof result == 'function');
}
});
// ----------------------------------------------------------------------------
var p = new Proxy({}, {});
newBenchmark("ProxyConstructorWithProxy", {
setup() { },
run() {
var proxy = new Proxy(p, {});
result = proxy;
},
teardown() {
return (typeof result == 'function');
}
});
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
load('../base.js');
load('proxies.js');
var success = true;
function PrintResult(name, result) {
print(name + '-Proxies(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
success = false;
}
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment