Reviewers: arv, Michael Achenbach, rossberg,
Message:
Erik, Andreas, please take a look.
My strategy here is:
1. Only test scenarios that we care about (for super lookups, only method
calls
and calls to named getters and setters)
2. These are microbenchmarks - some care is taken to prevent dead code
elimination etc.
Michael, please take a look to make sure I've got all the infrastructure
stuff
right.
Description:
Initial set of perf tests for classes.
[email protected],[email protected],[email protected]
Please review this at https://codereview.chromium.org/645933003/
Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+73, -4 lines):
A test/js-perf-test/Classes/Classes.json
A + test/js-perf-test/Classes/base.js
A + test/js-perf-test/Classes/run.js
A test/js-perf-test/Classes/super.js
Index: test/js-perf-test/Classes/Classes.json
diff --git a/test/js-perf-test/Classes/Classes.json
b/test/js-perf-test/Classes/Classes.json
new file mode 100644
index
0000000000000000000000000000000000000000..6316a0824f0da53b283d9a17adc1ce3f3e383c49
--- /dev/null
+++ b/test/js-perf-test/Classes/Classes.json
@@ -0,0 +1,12 @@
+{
+ "path": ["."],
+ "main": "run.js",
+ "flags": ["--harmony-classes"],
+ "run_count": 5,
+ "units": "score",
+ "results_regexp": "^%s\\-Classes\\(Score\\): (.+)$",
+ "total": true,
+ "tests": [
+ {"name": "Super"},
+ ]
+}
Index: test/js-perf-test/Classes/base.js
diff --git a/test/js-perf-test/Collections/base.js
b/test/js-perf-test/Classes/base.js
similarity index 100%
copy from test/js-perf-test/Collections/base.js
copy to test/js-perf-test/Classes/base.js
Index: test/js-perf-test/Classes/run.js
diff --git a/test/js-perf-test/Collections/run.js
b/test/js-perf-test/Classes/run.js
similarity index 81%
copy from test/js-perf-test/Collections/run.js
copy to test/js-perf-test/Classes/run.js
index
cfd1aef5256b813ade9f3883426c6f67ec32cf47..44ce7c25ebc7588651d8e295e76d3c57465a14f5
100644
--- a/test/js-perf-test/Collections/run.js
+++ b/test/js-perf-test/Classes/run.js
@@ -4,16 +4,13 @@
load('base.js');
-load('map.js');
-load('set.js');
-load('weakmap.js');
-load('weakset.js');
+load('super.js');
var success = true;
function PrintResult(name, result) {
- print(name + '-Collections(Score): ' + result);
+ print(name + '-Classes(Score): ' + result);
}
Index: test/js-perf-test/Classes/super.js
diff --git a/test/js-perf-test/Classes/super.js
b/test/js-perf-test/Classes/super.js
new file mode 100644
index
0000000000000000000000000000000000000000..01dff04174369e05c98872ed09b24dd3600b7222
--- /dev/null
+++ b/test/js-perf-test/Classes/super.js
@@ -0,0 +1,60 @@
+// Copyright 2014 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.
+'use strict';
+
+var SuperBenchmark = new BenchmarkSuite('Super', [1000], [
+ new Benchmark('SuperMethodCall', false, false, 0, SuperMethodCall),
+ new Benchmark('SuperGetterCall', false, false, 0, SuperGetterCall),
+ new Benchmark('SuperSetterCall', false, false, 0, SuperSetterCall),
+]);
+
+
+function Base() { }
+function Derived() {
+ this._x = 1;
+}
+
+
+Base.prototype = {
+ constructor: Base,
+ get x() {
+ return this._x++;
+ },
+ set x(v) {
+ this._x += v;
+ return this._x;
+ }
+}
+
+Base.prototype.f = function() {
+ return this._x++;
+}.toMethod(Base.prototype);
+
+Derived.prototype = Object.create(Base.prototype);
+
+Derived.prototype.SuperCall = function() {
+ return super.f();
+}.toMethod(Derived.prototype);
+
+Derived.prototype.GetterCall = function() {
+ return super.x;
+}.toMethod(Derived.prototype);
+
+Derived.prototype.SetterCall = function() {
+ return super.x = 5;
+}.toMethod(Derived.prototype);
+
+var derived = new Derived();
+
+function SuperMethodCall() {
+ return derived.SuperCall();
+}
+
+function SuperGetterCall() {
+ return derived.GetterCall();
+}
+
+function SuperSetterCall() {
+ return derived.SetterCall();
+}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.