Xcode 11 调试器非常慢 - 一个已知问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/58095866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:02:04  来源:igfitidea点击:

Xcode 11 debugger is extremely slow - A known problem?

iosxcode

提问by Andrei Herford

Since I updated to the latest Xcode version 11.0 (11A420a) the debugging is extremely slow and cumbersome.

由于我更新到最新的 Xcode 版本 11.0 (11A420a),调试非常缓慢和麻烦。

EDIT:After updating to 11.1 GM (11A1027) the problem is still the same.

编辑:更新到 11.1 GM (11A1027) 后问题依旧。

Compiling a project and running it in simulator or on a device is no problem. However when reaching a breakpoint Xcode becomes more or less unusable:

编译一个项目并在模拟器或设备上运行它是没有问题的。然而,当到达断点时 Xcode 或多或少变得不可用:

  • Program execution stops immediately when the breakpoint is reached. However Xcode needs up to 30 seconds to show the position in the code window and another minute or so to load the content of the variable view (which shows the values and states of the variables available at the breakpoint).
  • If I use the Step intoor Step overfeatures it takes up to a minute to perform the next step and again another minute to load the variables.
  • 当到达断点时,程序执行立即停止。然而,Xcode 需要最多 30 秒来显示代码窗口中的位置,另外需要一分钟左右来加载变量视图的内容(显示断点处可用变量的值和状态)。
  • 如果我使用Step intoStep over功能,执行下一步最多需要一分钟,然后又需要一分钟来加载变量。

I am running Xcode on a Mac mini 2018 with a 3.2 GHz i7 and 32 GB ram. I have used Xcode 10 on the same machine before without any problems.

我在配备 3.2 GHz i7 和 32 GB 内存的 Mac mini 2018 上运行 Xcode。我之前在同一台机器上使用过 Xcode 10,没有任何问题。



Searching for "Xcode slow" brings up a ton of threads and possible solutions of course. From my years as iOS Developer I know that Xcode never was the fastest and stable program. However it was never as bad as now.

当然,搜索“Xcode 慢”会带来大量线程和可能的解决方案。从我担任 iOS 开发人员的那几年开始,我就知道 Xcode 从来都不是最快和最稳定的程序。然而,它从来没有像现在这样糟糕。

Unfortunately none of the know tricks (restarting Xcode or the Mac, cleaning the project, cleaning the Xcode library folders, etc. had any effect,

不幸的是,所有已知技巧(重新启动 Xcode 或 Mac、清理项目、清理 Xcode 库文件夹等)都没有任何效果,

So the big question is:

所以最大的问题是:

Is this a known problem in Xcode 11? Are there any known solutions?

这是 Xcode 11 中的已知问题吗?是否有任何已知的解决方案?

回答by Gennadiy Ryabkin

Well I had the same problem and recently figured out that I just forgot to disable diagnostics for my scheme

好吧,我遇到了同样的问题,最近发现我只是忘记为我的计划禁用诊断

enter image description here

在此处输入图片说明

Open your run configurations -> Manage schemes -> Edit scheme -> Run -> Diagnostics tab

打开您的运行配置 -> 管理方案 -> 编辑方案 -> 运行 -> 诊断选项卡

回答by Giorgio Daino

I've found the same problems in two different cases:

我在两种不同的情况下发现了相同的问题:

1) the app is not launched by Xcode, i.e. the flag "Wait for executable to be launched" is set inside the Info panel of the Scheme Run settings;

1)该应用程序不是由Xcode启动的,即在Scheme Run设置的Info面板中设置了“等待可执行文件启动”标志;

2) the option "Launch due to a background fetch event" is selected in the scheme settings (but this is not the default)

2)在方案设置中选择了“Launch due to a background fetch event”选项(但这不是默认的)

Xcode option position

Xcode 选项位置

Xcode 11.2.1 (11B500)

Xcode 11.2.1 (11B500)

回答by Reuben Scratton

In my case (XCode 11.x, MacOS 10.15.2) I've found that the extreme debugger slowness is only triggered if I single-step while another single-step operation is in progress, i.e. I press the step button too quickly. My current workaround is to avoid doing that.

在我的情况下(XCode 11.x,MacOS 10.15.2),我发现只有当我单步执行另一个单步操作时才会触发极度缓慢的调试器,即我太快地按下单步按钮。我目前的解决方法是避免这样做。

Pure speculation but perhaps it's triggered by XCode/LLDB trying to service multiple breakpoints concurrently? Try removing all breakpoints but one and see if that helps things.

纯粹的猜测,但也许它是由 XCode/LLDB 尝试同时为多个断点提供服务触发的?尝试删除除一个之外的所有断点,看看是否有帮助。

In case it's relevant: I mostly work with C++ in XCode, with a little Obj-C here and there. I don't use Swift at all at present.

以防万一:我主要在 XCode 中使用 C++,并在这里和那里使用一点 Obj-C。我目前根本不使用 Swift。

回答by Tommie C.

I've seen some performance improvements when using the Whole versus Incremental Compilation behavior. Additionally running on Mojave and Catalina should both be showing performance issues. Specifically since the Canvas preview and other new features require more CPU intensity than the last version of Xcode, I would expect Mojave performance to be lower when using Xcode 11 (as it's not optimized for this version of the OS). With Catalina being in Beta, I'd expect to see additional issues as well. I haven't taken specific measures other than the eye-test. The initial run on Whole Compilation is slow but seems to get better thereafter.

在使用整体编译与增量编译行为时,我看到了一些性能改进。此外,在 Mojave 和 Catalina 上运行应该都会出现性能问题。特别是因为 Canvas 预览和其他新功能需要比上一版 Xcode 更高的 CPU 强度,我预计使用 Xcode 11 时 Mojave 的性能会更低(因为它没有针对这个版本的操作系统进行优化)。由于 Catalina 处于 Beta 阶段,我希望还会看到其他问题。除了眼睛检查,我没有采取任何具体措施。Whole Compilation 的初始运行速度很慢,但此后似乎变得更好。

Quick help states:

快速帮助指出:

Summary

This setting controls the way the Swift files in a module are rebuilt. * Incremental: Only rebuild the Swift source files in the module that are out of date, running multiple compiler processes as needed. * Whole Module: Always rebuild all Swift source files in the module, in a single compiler process. Declaration

SWIFT_COMPILATION_MODE Value Type

Enumeration (String)

概括

此设置控制模块中 Swift 文件的重建方式。*增量:只重建模块中过时的Swift源文件,根据需要运行多个编译器进程。* 整个模块:始终在单个编译器进程中重建模块中的所有 Swift 源文件。宣言

SWIFT_COMPILATION_MODE 值类型

枚举(字符串)

回答by Dino

Have you tried running Xcode in safe mode? It's not ideal, but this was the only way I could get it to run efficiently. That is until the recent Catalina update where my device is no longer detected in safe mode. So I'm back to square one now.

您是否尝试过在安全模式下运行 Xcode?这并不理想,但这是我让它有效运行的唯一方法。直到最近的 Catalina 更新,在安全模式下不再检测到我的设备。所以我现在回到第一个。