servo/support/hitrace-bencher/parse_from_string.html
Narfinger c3f441d7ab
OHOS CI: Allow benchmarking of files and show smaps (#37881)
OHOS CI: Now we can benchmark specific files. These files need to be in
the runs.json and in the supprt/hitrace-bench folder.
A simple testcase of parsing html from string is included (taken from
https://github.com/servo/servo/issues/37223).
We copy all files in
support/hitrace-bench into the hap of the phone.
These files can use the console.log javascript command to get their
measured output.

Additionally, this now supports reporting resident-accordings-to-smaps
which is a slightly different memory than resident.

This needs update to hitrace-bench 0.7 which will be completed once the
PR is marked ready.

Testing: On action runner here:
https://github.com/Narfinger/servo/actions/runs/16118101025/job/45477031813

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-07-08 11:01:02 +00:00

37 lines
1,020 B
HTML

<html>
<script>
function generateHTML(count) {
let html = '';
for (let i = 0; i < count; i++) {
html += `<div>
<h2>Item ${i}</h2>
<p>This is paragraph number ${i}</p>
<ul>
<li>A</li><li>B</li><li>C</li>
</ul>
</div>`;
}
return html;
}
function run() {
const result = document.getElementById("result");
const html = generateHTML(15000);
const parser = new DOMParser();
const start = performance.now();
const doc = parser.parseFromString(html, "text/html");
const end = performance.now();
const result_text = (end - start).toFixed(0);
result.textContent = `Total: ${result_text} ms`;
alert("TESTCASE_PROFILING: parsefromstring:" + result_text);
};
</script>
<body onload="run()">
<button id="run">Run Script</button>
<div id="result"></div>
</body>
</html>