Skip to content

feat(core): Further optimize debug ID parsing - #14365

Merged
lforst merged 8 commits into
developfrom
timfish/feat/debug-id-parse
Nov 27, 2024
Merged

lforst merged 8 commits into
developfrom
timfish/feat/debug-id-parse

Conversation

@timfish

@timfish timfish commented Nov 19, 2024 •

Copy link
Copy Markdown
Collaborator

This PR further optimises debug ID parsing.

  • Removes some side-effects. We only init the Map if we're actually using debug IDs
  • If globalThis._sentryDebugIds hasn't been modified since the last call, we return a cached result
  • Caches { filename, debugId } rather than StackFrame[] so we no longer walk the frames every time
  • Changes ANR to simply call getFilenameToDebugIdMap() since we can now rely on the caching
  • I removed the cache per stack parser because we don't use multiple stack parsers and this saved most of the addition to the bundle size

@github-actions

github-actions Bot commented Nov 19, 2024 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.12 KB +0.11% +25 B 🔺
@sentry/browser - with treeshaking flags 21.84 KB +0.12% +26 B 🔺
@sentry/browser (incl. Tracing) 35.7 KB +0.05% +17 B 🔺
@sentry/browser (incl. Tracing, Replay) 72.6 KB +0.05% +37 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.97 KB -0.01% -2 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 76.92 KB +0.05% +33 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 89.37 KB +0.03% +25 B 🔺
@sentry/browser (incl. Feedback) 39.86 KB +0.09% +34 B 🔺
@sentry/browser (incl. sendFeedback) 27.73 KB +0.04% +9 B 🔺
@sentry/browser (incl. FeedbackAsync) 32.53 KB +0.08% +26 B 🔺
@sentry/react 25.8 KB +0.09% +23 B 🔺
@sentry/react (incl. Tracing) 38.51 KB +0.05% +16 B 🔺
@sentry/vue 27.28 KB +0.03% +7 B 🔺
@sentry/vue (incl. Tracing) 37.49 KB +0.02% +4 B 🔺
@sentry/svelte 23.27 KB +0.09% +21 B 🔺
CDN Bundle 24.29 KB +0.06% +14 B 🔺
CDN Bundle (incl. Tracing) 37.31 KB +0.04% +13 B 🔺
CDN Bundle (incl. Tracing, Replay) 72.21 KB +0.03% +15 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 77.55 KB +0.03% +17 B 🔺
CDN Bundle - uncompressed 71.37 KB +0.03% +20 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 110.69 KB +0.02% +20 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 223.76 KB +0.01% +20 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 236.97 KB +0.01% +20 B 🔺
@sentry/nextjs (client) 38.83 KB +0.01% +1 B 🔺
@sentry/sveltekit (client) 36.21 KB +0.07% +24 B 🔺
@sentry/node 134.8 KB +0.02% +15 B 🔺
@sentry/node - without tracing 96.64 KB +0.03% +24 B 🔺
@sentry/aws-serverless 106.85 KB +0.02% +19 B 🔺

View base workflow run

@timfish

timfish commented Nov 19, 2024

Copy link
Copy Markdown
Collaborator Author

I'm disappointed this hits the bundle size like this 😭

Let me see if I can help that...

@timfish
timfish force-pushed the timfish/feat/debug-id-parse branch from 835eb5a to 57b6625 Compare November 19, 2024 13:23
@timfish
timfish marked this pull request as ready for review November 20, 2024 03:46
@timfish
timfish requested a review from lforst November 20, 2024 14:58

@AbhiPrasad AbhiPrasad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bundle size reduction!

@lforst

lforst commented Nov 26, 2024

Copy link
Copy Markdown
Contributor

Since the size-checker doesn't seem entirely happy with this PR I would suggest keeping the logic for multiple stack parsers. I know it is unlikely to happen that you have more than 1 but it is technically correct.

The rest seems good though 👍

@timfish

timfish commented Nov 26, 2024 •

Copy link
Copy Markdown
Collaborator Author

Before I removed the logic for multiple stack parsers, the size additions were 2-3x what they are now.

@lforst

lforst commented Nov 27, 2024

Copy link
Copy Markdown
Contributor

Before I removed the logic for multiple stack parsers, the size additions were 2-3x what they are now.

convinced

@lforst
lforst merged commit de65590 into develop Nov 27, 2024
@lforst
lforst deleted the timfish/feat/debug-id-parse branch November 27, 2024 08:17
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.

3 participants