From ac9f1282fd39380b3e7cc0d41a44c87c1da18b93 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Wed, 22 May 2019 23:43:26 +0200 Subject: [PATCH] Added new performance tests --- test/performanceTest.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/performanceTest.js b/test/performanceTest.js index 5e82230..3765653 100644 --- a/test/performanceTest.js +++ b/test/performanceTest.js @@ -151,5 +151,27 @@ var randomImageTest = function(){ }; }(); +var innerHTMlTest = function(html, repeats){ + "use strict"; + + var div; + + return { + prepareOnce: function(){ + div = document.createElement("div"); + div.style.visibility = "hidden"; + document.body.appendChild(div); + }, + test: function randomImageTest(){ + for (var i = repeats; i--;){ + div.innerHTML = html; + div.innerHTML = ""; + } + } + }; +}; + performTest("fingerprinting", fingerprintTest, 10, 100); -performTest("big random image", randomImageTest, 10, 10); \ No newline at end of file +performTest("big random image", randomImageTest, 10, 10); +performTest("innerHTML (100 times)", innerHTMlTest("text
no iframe", 1000), 10, 30); +performTest("innerHTML with iframe (20 times)", innerHTMlTest("text
iframe: ", 20), 10, 10); \ No newline at end of file