1<!DOCTYPE html> 2<html> 3<body> 4<script src="../resources/runner.js"></script> 5<script> 6// Taken from http://jsperf.com/parse-html-type 7// The major difference between this test and innerHTML-setter.html 8// is that innerHTML-setter creates a single root node 9// which avoids some of the costs in transplating nodes from the 10// intermediary DocumentFragment to its final parent. 11var tags = '<div></div><div></div><div></div><div></div><div></div>'; 12var attr = '<div foo="bar" foo="bar" foo="bar" foo="bar sda"></div>'; 13var nest = '<div><div><div><div><div></div></div></div></div></div>'; 14 15var tags10 = tags + tags + tags + tags + tags + tags + tags + tags + tags + tags; 16var attr10 = attr + attr + attr + attr + attr + attr + attr + attr + attr + attr; 17var nest10 = nest + nest + nest + nest + nest + nest + nest + nest + nest + nest; 18 19var div = document.createElement('div'); 20 21PerfTestRunner.measureRunsPerSecond({ 22 description: "This benchmark tests innerHTML setter for a large DOM tree", 23 run: function() { 24 div.innerHTML = tags10; 25 div.innerHTML = attr10; 26 div.innerHTML = nest10; 27 div.innerHTML = ""; 28 }}); 29</script> 30</body> 31</html> 32