Commit 24b07838 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Introduce blink/perf_tests/paint/select-all-words.html


This patch introduces a performance test file "select-all-words.html" for
measuring painting selection.

See https://bit.ly/2SyNQS1 for profiling sample comparing legacy layout and
LayoutNG.

As of February 7, 2019, LayoutNG is two times slower than legacy layout.

Change-Id: I8c5fe8418715b7d0078f6f1186c4191a1fb7d850
Reviewed-on: https://chromium-review.googlesource.com/c/1457701
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629909}
parent 7e25dff4
<!doctype html>
<body>
<script src="../resources/runner.js"></script>
<script src="../layout/resources/line-layout-perf-test.js"></script>
<div id="container"></div>
<script>
const kNumberOfWords = 10000 * 30;
const kCount = 10;
const container = document.getElementById('container');
const selection = window.getSelection();
container.textContent = (() => {
const words = [];
for (let i = 0; i < kNumberOfWords; ++i)
words.push(TextGenerator.createWord(i % 12 + 3));
return words.join(' ');
})();
let isDone = false;
let startTime = 0;
let counter = 0;
function runTest() {
if (startTime !== 0 && counter % kCount === 0) {
PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
PerfTestRunner.addRunTestEndMarker(); // For tracing metrics
}
if (isDone)
return;
window.requestAnimationFrame(() => {
if (counter % kCount === 0) {
PerfTestRunner.addRunTestStartMarker();
startTime = PerfTestRunner.now(); // For tracing metrics
}
selection.collapse(container, 0);
if (counter % 2 === 1)
selection.extend(container, 1);
++counter;
runTest();
});
}
PerfTestRunner.startMeasureValuesAsync({
unit: 'ms',
run: function() {
runTest();
},
done: function() {
container.textContent = '';
isDone = true;
},
iterationCount: 10,
tracingCategories: 'blink',
traceEventsToMeasure: [
'LocalFrameView::RunPrePaintLifecyclePhase',
'LocalFrameView::RunPaintLifecyclePhase'
],
});
</script>
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