Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
CleanVsDirty
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:139.0) Gecko/20100101 Firefox/139.0
Browser:
Firefox 139
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
Dirty
217.1 Ops/sec
Clean
193.1 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
Dirty
printHtmlContent = (htmlContent) => { const iframe = document.createElement("iframe"); iframe.style.display = "none"; document.body.appendChild(iframe); iframe.contentWindow.addEventListener("afterprint", () => { document.body.removeChild(iframe); }); // Add CSS to remove headers and footers const cssToRemoveHeadersAndFooters = `<style> @page { margin: 0; size: auto; } @media print { body { margin: 0; padding: 0; } } </style> `; iframe.contentWindow.document.open(); iframe.contentWindow.document.write(cssToRemoveHeadersAndFooters + htmlContent); iframe.contentWindow.document.close(); iframe.contentWindow.focus(); }; printHtmlContent('<div>Hello, World</div>');
Clean
printHtmlContent = (htmlContent) => { const createTemporaryIframe = () => { const iframe = document.createElement("iframe"); iframe.style.display = "none"; document.body.appendChild(iframe); return iframe; }; const writeToIframe = (iframe, content) => { iframe.contentWindow.document.open(); iframe.contentWindow.document.write(content); iframe.contentWindow.document.close(); }; const addPrintEventListeners = (iframe) => { iframe.contentWindow.addEventListener("afterprint", () => { document.body.removeChild(iframe); }); }; const printIframe = (iframe) => { iframe.contentWindow.focus(); }; // Add CSS to remove headers and footers const cssToRemoveHeadersAndFooters = ` <style> @page { margin: 0; size: auto; } @media print { body { margin: 0; padding: 0; } } </style> `; const iframe = createTemporaryIframe(); writeToIframe(iframe, cssToRemoveHeadersAndFooters + htmlContent); addPrintEventListeners(iframe); printIframe(iframe); }; printHtmlContent('<div>Hello, World</div>');