Skip to content

ref(core): Avoid unnecessary breadcrumbs array mutations #8957

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

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Sep 6, 2023

This is a micro improvement, but maybe worth it as we can have a lot of breadcrumbs. This ensures we only create a new breadcrumbs array if we exceed the limit.

In contrast, currently we'll always create two copies of the breadcrumbs for each added breadcrumb (first for the array spread, then we copy it through the slice), even if we don't really need to do this.

This is a micro improvement, but maybe worth it as we can have a lot of breadcrumbs. This ensures we only create a new breadcrumbs array if we exceed the limit.

In contrast, currently we'll always create two copies of the breadcrumbs for each added breadcrumb (first for the array spread, then we copy it through the slice), even if we don't really need to do this.
@mydea mydea requested review from lforst, Lms24 and AbhiPrasad September 6, 2023 10:05
@mydea mydea self-assigned this Sep 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 75.36 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.25 KB (+0.07% 🔺)
@sentry/browser - Webpack (gzipped) 21.85 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 69.88 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.2 KB (+0.09% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 20.19 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 220.83 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 85.11 KB (+0.1% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 59.75 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.09 KB (+0.06% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 75.38 KB (+0.04% 🔺)
@sentry/react - Webpack (gzipped) 21.89 KB (+0.05% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 93.23 KB (+0.02% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 50.82 KB (+0.05% 🔺)

@mydea mydea merged commit 8e99ba9 into develop Sep 6, 2023
@mydea mydea deleted the fn/avoid-breadcrumbs-new-array branch September 6, 2023 11:53
onurtemizkan pushed a commit that referenced this pull request Sep 7, 2023
This is a micro improvement, but maybe worth it as we can have a lot of
breadcrumbs. This ensures we only create a new breadcrumbs array if we
exceed the limit.

In contrast, currently we'll always create two copies of the breadcrumbs
for each added breadcrumb (first for the array spread, then we copy it
through the slice), even if we don't really need to do this.
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