iPhone Simulator suddenly started running very slow

后端 未结 13 1950
梦毁少年i
梦毁少年i 2020-12-02 04:54

I have been working on an app in iphone simulator for a number of weeks and it has been running well up until now, but all of a sudden has begun running very slow both when

13条回答
  •  被撕碎了的回忆
    2020-12-02 05:18

    It is NOT only about slow animations. Xcode simulator has extremely low performance in global. It is Apple's bug. I have reported it via Feedback Assistant. I have created demo with code demonstrating that simulator is 200 times slower than any old real device. I have found that JavaScript code with Date object executed in WKWebView is pain for simulator. Changing options in simulator does not help in my case. See jsfiddle https://jsfiddle.net/kjms16cw/ I hope Apple will fix it soon!

    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";
    }

    Xcode Simulator Extremely Low Performance

    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!

提交回复
热议问题