getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
815 stars 330 forks source link

ref: Reduce nesting in performance tracker #4520

Closed philipphofmann closed 1 week ago

philipphofmann commented 2 weeks ago

Reduce nesting in startSpanWithName by using .span instead of useSpan.

useSpan basically does the same.

https://github.com/getsentry/sentry-cocoa/blob/9854a5751cac3edac5b75aec7b68c36728269aaa/Sources/Sentry/SentryScope.m#L149-L156

This PR depends on https://github.com/getsentry/sentry-cocoa/pull/4519 cause scope.getSpan isn't thread-safe yet.

skip-changelog

github-actions[bot] commented 2 weeks ago

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1239.52 ms 1257.02 ms 17.50 ms
Size 21.90 KiB 727.56 KiB 705.66 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
6bc5ae5e4f3e1fb4414ab1b0643ffc3ec87ded1f 1230.90 ms 1246.10 ms 15.20 ms
3d8532d83db2ffb27f1a487cbdc8d61b34f4e675 1225.27 ms 1238.80 ms 13.53 ms
fa1ec4470d0e9e94741a914e76767318077e01f2 1216.80 ms 1244.42 ms 27.62 ms
5616e0a239f7f0d4255197a901318c62d7c82833 1237.00 ms 1260.43 ms 23.43 ms
ed49f0c45e853d078735099abd82315b08ebb099 1215.94 ms 1245.63 ms 29.69 ms
af1f4dd2342784c9d799dececf5cd16596847e32 1238.08 ms 1258.48 ms 20.40 ms
50bb751cfe50189673d3c0ec5b0d664659218ade 1207.51 ms 1219.37 ms 11.86 ms
c838244d1b16ffc7b314143efb20381defcbe9ca 1213.51 ms 1243.76 ms 30.24 ms
39b1c353b26407f787556148d2c9ef35d6a394f5 1236.35 ms 1239.90 ms 3.55 ms
56ec5d04c9b2d9c989dfc5e55f904c537bdc2956 1236.65 ms 1261.90 ms 25.25 ms

App size

Revision Plain With Sentry Diff
6bc5ae5e4f3e1fb4414ab1b0643ffc3ec87ded1f 20.76 KiB 401.40 KiB 380.64 KiB
3d8532d83db2ffb27f1a487cbdc8d61b34f4e675 22.85 KiB 414.09 KiB 391.24 KiB
fa1ec4470d0e9e94741a914e76767318077e01f2 21.58 KiB 670.39 KiB 648.81 KiB
5616e0a239f7f0d4255197a901318c62d7c82833 22.85 KiB 407.45 KiB 384.60 KiB
ed49f0c45e853d078735099abd82315b08ebb099 21.58 KiB 632.13 KiB 610.55 KiB
af1f4dd2342784c9d799dececf5cd16596847e32 22.85 KiB 414.71 KiB 391.86 KiB
50bb751cfe50189673d3c0ec5b0d664659218ade 21.58 KiB 417.86 KiB 396.27 KiB
c838244d1b16ffc7b314143efb20381defcbe9ca 21.58 KiB 629.61 KiB 608.03 KiB
39b1c353b26407f787556148d2c9ef35d6a394f5 22.85 KiB 408.88 KiB 386.03 KiB
56ec5d04c9b2d9c989dfc5e55f904c537bdc2956 20.76 KiB 414.44 KiB 393.69 KiB
codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.469%. Comparing base (9854a57) to head (696e7c4). Report is 9 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520/graphs/tree.svg?width=650&height=150&src=pr&token=PTZKtOJlrs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry)](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) ```diff @@ Coverage Diff @@ ## main #4520 +/- ## ============================================= + Coverage 91.462% 91.469% +0.006% ============================================= Files 615 615 Lines 68991 68987 -4 Branches 24749 24744 -5 ============================================= + Hits 63101 63102 +1 + Misses 5798 5793 -5 Partials 92 92 ``` | [Files with missing lines](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [Sources/Sentry/SentryPerformanceTracker.m](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520?src=pr&el=tree&filepath=Sources%2FSentry%2FSentryPerformanceTracker.m&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-U291cmNlcy9TZW50cnkvU2VudHJ5UGVyZm9ybWFuY2VUcmFja2VyLm0=) | `100.000% <100.000%> (ø)` | | ... and [10 files with indirect coverage changes](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). Last update [9854a57...696e7c4](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4520?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry).