Replies: 2 comments 12 replies
-
|
Hi @jshier, we would be open to disabling the perception checks in tests. Would you like to PR that? But for the time being I am going to convert this to a discussion because you can always disable these checks in your own tests. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, guys. Probably I have the same issue - the app hangs a lot when I run it in debug configuration. The project I'm working on is a fork of CopilotForXcode. Could you help me find the source of the bug? |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Description
In apps where backtraces take more time, perception checks when accessing
ObservableStateproperties can take significant time. In our large production app, each access of an@ObservationStateTrackedproperty takes about 0.08s, due entirely toisSwiftUI(). ForStates with many properties, this can lead to significant execution time for tests.Disabling perception checking for the test fixes the performance issue.
Checklist
@Observablemacro or another tool from theObservationframework, please file it directly with Apple.mainbranch of this package.Expected behavior
I would expect perception checks to be off by default for tests, or for
isSwiftUI()to otherwise short circuit, as there's no way for SwiftUI symbols to be in the backtrace.Actual behavior
Significant time is spent in
isSwiftUIthrough the registrarsaccessmethod.Steps to reproduce
You can observe this work in any test that accesses tracked state, but it seems to be more noticeable the slower the backtrace call becomes.
Perception version information
2.0.6
Destination operating system
iOS 18.5 Simulator
Xcode version information
16.4
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions