summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/PerformanceTests
diff options
context:
space:
mode:
authorleviw <leviw@chromium.org>2016-01-20 14:36:36 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-20 22:37:54 +0000
commit298c94dfabdfbd77eb11eaf831bf09ade396e8b9 (patch)
tree77718359855dcfa4365f81f83a15a060a67c9239 /third_party/WebKit/PerformanceTests
parentb1508b458c95ac70b9b57fb3dd507b398b43e93b (diff)
downloadchromium_src-298c94dfabdfbd77eb11eaf831bf09ade396e8b9.zip
chromium_src-298c94dfabdfbd77eb11eaf831bf09ade396e8b9.tar.gz
chromium_src-298c94dfabdfbd77eb11eaf831bf09ade396e8b9.tar.bz2
Add a perf test for hit testing in pages with many layers
We walk the entire layer tree for things like hit-testing, unlike the layout tree which has the ability to prune subtrees. Adding a performance test for this case. Locally, the median goes from 0.6523144883778171 runs/s as uploaded to 2.2783917566470437 runs/s if you remove the position: relative (and hence the layer). Review URL: https://codereview.chromium.org/1533513003 Cr-Commit-Position: refs/heads/master@{#370512}
Diffstat (limited to 'third_party/WebKit/PerformanceTests')
-rw-r--r--third_party/WebKit/PerformanceTests/Events/hit-test-lots-of-layers.html37
1 files changed, 37 insertions, 0 deletions
diff --git a/third_party/WebKit/PerformanceTests/Events/hit-test-lots-of-layers.html b/third_party/WebKit/PerformanceTests/Events/hit-test-lots-of-layers.html
new file mode 100644
index 0000000..55ff9c5
--- /dev/null
+++ b/third_party/WebKit/PerformanceTests/Events/hit-test-lots-of-layers.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<style>
+body {
+ display: flex;
+ flex-wrap: wrap;
+}
+div {
+ height: 1px;
+ width: 200px;
+ position: relative;
+ background-color: green;
+}
+</style>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 5000;
+function setupTest() {
+ for (var i = 0; i < count; ++i)
+ document.body.appendChild(document.createElement("div"));
+}
+
+setupTest();
+
+function test() {
+ for (var i = 0; i < 1000; i++) {
+ var x = 600 * Math.random();
+ var y = 400 * Math.random();
+ var el = document.elementFromPoint(x, y);
+ }
+}
+
+PerfTestRunner.measureRunsPerSecond({
+description: "Measures hit test performance with many layers.",
+run: test
+});
+</script>