-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Labels
C-has-manual-testcaseC-needs-investigationI-perf-slowUnnecessary performance degredation.Unnecessary performance degredation.
Description
When using the Vue framework, the element.innerHTML interface took a long time.
Seems it was a performance issue with the htmlparser.
The following code only takes 50ms in Chrome on the Windows platform, while it takes 5000ms in Servo.
I was trying to analyze this problem. Any idea to track it?
<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;
}
document.getElementById("run").addEventListener("click", function () {
const result = document.getElementById("result");
const html = generateHTML(5000);
const parser = new DOMParser();
const start = performance.now();
const doc = parser.parseFromString(html, "text/html");
const end = performance.now();
result.textContent = `total: ${(end - start).toFixed(2)} ms`;
});
</script>simonwuelker
Metadata
Metadata
Assignees
Labels
C-has-manual-testcaseC-needs-investigationI-perf-slowUnnecessary performance degredation.Unnecessary performance degredation.