var log = document.getElementById("log");
document.getElementById("button").onclick = function() { run(); };
function run() {
var d1 = new Date();
for (var i = 0; i < 1000; i++) {
var x = new Date();
x.setMilliseconds(0);
x.setSeconds(0);
x.setMinutes(0);
}
var d2 = new Date();
log.innerHTML = ((d2.getTime() - d1.getTime()) / 1000) + " seconds";
}
<h3>Xcode Simulator Extremely Low Performance</h3>
<p>This test runs fast (several tens milliseconds e.g. 30 ms)
in any browser any device any platform including very old iOS device
e.g. iPhone 5C and several years old iPad 2, BUT IN SIMULATOR IT TAKES 6000 ms
(yes, 6 seconds!). Terrible!</p>
<button id="button">run()</button>
<div id="log"></div>