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

impr: Slightly speed up SentryInAppLogic #4370

Merged
merged 2 commits into from
Sep 26, 2024
Merged

Conversation

philipphofmann
Copy link
Member

📜 Description

Slightly speed up the SentryInAppLogic by avoiding calls to lastPathComponent and lowercaseString in loops. Both properties require some extra work, such as iterating over the contents of the string. This is noticeable for larger apps with many images and inAppIncludes and inAppExcludes. For small apps, this doesn't make a difference.

💡 Motivation and Context

This came up while investigating the Sentry Cocoa SDK potentially slowing down a specific UIViewController of a customer.

💚 How did you test it?

Unit tests still pass, and by running a performance test locally, which doesn't work in CI, so I'm not adding it.

📝 Checklist

You have to check all boxes before merging:

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Slightly speed up the SentryInAppLogic by avoiding calls to
lastPathComponent and lowercaseString in loops. Both properties require
some extra work, such as iterating over the contents of the string. This
is noticeable for larger apps with many images and inAppIncludes and
inAppExcludes. For small apps, this doesn't make a difference.
Sources/Sentry/SentryInAppLogic.m Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.453%. Comparing base (3138592) to head (44bb4cd).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4370       +/-   ##
=============================================
- Coverage   91.535%   91.453%   -0.083%     
=============================================
  Files          628       631        +3     
  Lines        50706     50769       +63     
  Branches     18396     18393        -3     
=============================================
+ Hits         46414     46430       +16     
- Misses        4199      4245       +46     
- Partials        93        94        +1     
Files with missing lines Coverage Δ
Sources/Sentry/SentryInAppLogic.m 100.000% <100.000%> (ø)

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3138592...44bb4cd. Read the comment docs.

@philipphofmann philipphofmann merged commit 3fda1c4 into main Sep 26, 2024
62 of 65 checks passed
@philipphofmann philipphofmann deleted the impr/speed-up-in-app branch September 26, 2024 07:37
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.

2 participants