Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve perception performance #24

Merged
merged 15 commits into from
Jan 20, 2024

Conversation

mbrandonw
Copy link
Member

We now cache the result of perception checking by the file/line where the registrar's access is called, but we only cache if it's true so that we do not need to check again if a warning has already been displayed. We do not cache if it's false so that we can check again next time, just in case the access is happening from a different view.

struct FeatureView: View {
let model = Model()
var body: some View {
Text(self.model.count.description)
Text(expectRuntimeWarning { self.model.count }.description)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated tests so that we can be very specific about exactly where the runtime warning is triggered. Before we were only testing that a warning was triggered somewhere or not at all.

@mbrandonw mbrandonw changed the base branch from tca-observation to main January 19, 2024 20:26
@mbrandonw mbrandonw merged commit 4224012 into main Jan 20, 2024
2 checks passed
@mbrandonw mbrandonw deleted the tca-observation-perception-performance branch January 20, 2024 00:14
@SongJiyeon
Copy link

@mbrandonw Can you tell me how to use that warning message to debug my perception? I just print the file and line with the warning message and it gave me "PerceptionRegister.swift", 124 to me where your method is in.

@mbrandonw
Copy link
Member Author

Hi @SongJiyeon, I'm not sure I understand the question. Can you start a discussion and provide more details?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants