iPhone Simulator suddenly started running very slow

后端 未结 13 1784
梦毁少年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";
    }
    <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>

    0 讨论(0)
  • 2020-12-02 05:24

    You can try to turn off remote debugging (Cmd-D -> Stop Remote JS Debugging). That usually speed things up.

    0 讨论(0)
  • 2020-12-02 05:26

    I don't have the rep yet to leave a comment, but I upvoted some answers here and wanted to say more. I had a problem with slow animations in the iOS Simulator, especially on rotation, and I found this post via Google. Indeed, somehow "Toggle Slow Animations" must have been on, because three shifts fixed it. At first, I didn't think this was a problem because there's no checkmark next to "Toggle Slow Animations." It turns out there's never a checkmark, or any indication from the menu whether it's on or off. So just try toggling it and see if the rotation/navigation is faster/slower.

    So, thank you!

    0 讨论(0)
  • 2020-12-02 05:27

    Simple Command + T will fix this problem.

    Command + T toggles the simulator's Slow Animations, which can be found under the Simulator Menu: Debug -> Slow Animations.

    0 讨论(0)
  • 2020-12-02 05:28

    When the chrome debug is active and the browser tab is not in the foreground, the emulator is slow too. For me, I decided to put the guide in the foreground.

    0 讨论(0)
  • 2020-12-02 05:33

    Simulator -> Reset contents and settings works for me. The issue seems to reappear when I debug my react-native code remotely. It could also be to do with AsyncStorage as nomad suggested.

    0 讨论(0)
提交回复
热议问题