Skip to content

Conversation

@noahsmartin
Copy link
Contributor

While looking at moving NotificationCenterWrapper to swift I noticed this separate cleanup opportunity. This moves the functions that bridged iOS/Mac notifications into a typedef, which is less lines of code (making it safer by reducing the chance for typos) and also more performant (less app size, fewer objc method dispatch)

It works even better in Swift (currently only used by tests) where you can just define a single typedef and get all the notifications bridged without having to write another line for each notification name

The main change is in SentryNSNotificationCenterWrapper.h the rest of the changes are just updating the callsites.

#skip-changelog

@codecov
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.264%. Comparing base (409a607) to head (1c1e623).
Report is 13 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #5566       +/-   ##
=============================================
+ Coverage   86.140%   86.264%   +0.123%     
=============================================
  Files          407       408        +1     
  Lines        35067     35069        +2     
  Branches     15017     15271      +254     
=============================================
+ Hits         30207     30252       +45     
+ Misses        4817      4770       -47     
- Partials        43        47        +4     
Files with missing lines Coverage Δ
...tryTestUtils/TestNSNotificationCenterWrapper.swift 88.953% <ø> (ø)
Sources/Sentry/SentryAppStateManager.m 100.000% <100.000%> (ø)
Sources/Sentry/SentryFramesTracker.m 99.502% <100.000%> (-0.015%) ⬇️
Sources/Sentry/SentryNSNotificationCenterWrapper.m 100.000% <ø> (ø)
Sources/Sentry/SentrySessionTracker.m 99.082% <100.000%> (-0.070%) ⬇️
...Sentry/include/SentryNSNotificationCenterWrapper.h 100.000% <100.000%> (ø)

... and 22 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 409a607...1c1e623. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@noahsmartin noahsmartin force-pushed the lightweightNotificationNames branch from b46bce5 to 5738cc0 Compare July 3, 2025 10:00
@noahsmartin noahsmartin force-pushed the lightweightNotificationNames branch from 5738cc0 to 1c1e623 Compare July 3, 2025 10:13
@github-actions
Copy link
Contributor

github-actions bot commented Jul 3, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1217.46 ms 1249.63 ms 32.17 ms
Size 23.75 KiB 873.74 KiB 849.99 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7148f97 1235.09 ms 1258.07 ms 22.98 ms
db9572a 1200.27 ms 1234.80 ms 34.53 ms
018037b 1209.31 ms 1228.33 ms 19.03 ms
7908e84 1224.33 ms 1246.39 ms 22.06 ms
2691350 1224.92 ms 1255.82 ms 30.90 ms
fdea6f5 1216.08 ms 1241.82 ms 25.73 ms
d637379 1226.43 ms 1250.77 ms 24.34 ms
f97a070 1218.88 ms 1253.12 ms 34.24 ms
63ac649 1192.10 ms 1216.78 ms 24.68 ms
aa0b738 1236.78 ms 1253.08 ms 16.31 ms

App size

Revision Plain With Sentry Diff
7148f97 23.75 KiB 854.78 KiB 831.03 KiB
db9572a 23.75 KiB 858.69 KiB 834.93 KiB
018037b 23.75 KiB 867.16 KiB 843.41 KiB
7908e84 23.74 KiB 872.75 KiB 849.00 KiB
2691350 23.75 KiB 850.73 KiB 826.98 KiB
fdea6f5 23.75 KiB 867.15 KiB 843.40 KiB
d637379 23.75 KiB 855.38 KiB 831.63 KiB
f97a070 23.75 KiB 858.68 KiB 834.93 KiB
63ac649 23.75 KiB 855.38 KiB 831.63 KiB
aa0b738 23.74 KiB 872.75 KiB 849.00 KiB

@noahsmartin noahsmartin marked this pull request as ready for review July 7, 2025 16:05
@noahsmartin noahsmartin merged commit 354b020 into main Jul 7, 2025
144 of 147 checks passed
@noahsmartin noahsmartin deleted the lightweightNotificationNames branch July 7, 2025 19:39
@philipphofmann
Copy link
Member

Way better thanks @noahsmartin.

philipsawyerdd added a commit to justin-doordash/sentry-cocoa that referenced this pull request Sep 25, 2025
philipsawyerdd added a commit to justin-doordash/sentry-cocoa that referenced this pull request Sep 25, 2025
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.

4 participants