Skip to content

feat(core): Use react-native-quick-base64 for envelope encoding when available#6314

Draft
alwx wants to merge 2 commits into
mainfrom
alwx/feature/base64-quick-base64
Draft

feat(core): Use react-native-quick-base64 for envelope encoding when available#6314
alwx wants to merge 2 commits into
mainfrom
alwx/feature/base64-quick-base64

Conversation

@alwx

@alwx alwx commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds react-native-quick-base64 as an optional peer dependency of @sentry/react-native. When the package is installed by the consumer, the SDK uses its native JSI base64 encoder (~10x faster than the bundled JS implementation) for envelope payloads on the RNSentry.captureEnvelope hot path. When the package is absent the SDK falls back to the existing base64-js-derived encoder in vendor/base64-js — no behavior change for users who do not opt in.

Changes:

  • New packages/core/src/js/utils/base64.tsencodeToBase64() resolves the encoder once and caches it. Tries require('react-native-quick-base64') first; falls back to base64StringFromByteArray from vendor/base64-js.
  • packages/core/src/js/wrapper.tscaptureEnvelope now calls encodeToBase64(envelopeBytes) instead of base64StringFromByteArray(envelopeBytes) directly.
  • packages/core/package.jsonreact-native-quick-base64 >=3.0.0 added to peerDependencies and marked optional: true in peerDependenciesMeta. No new required deps.
  • CHANGELOG.md — entry under Unreleased / Features.

💡 Motivation and Context

Closes #4884.

💚 How did you test it?

Addded tests!

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

  • Real-device benchmark on a large envelope (profile / replay) to confirm the headline ~10x figure in our pipeline.
  • Optionally mention react-native-quick-base64 in the Sentry docs as a recommended performance install for users shipping large payloads.

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(core): Use react-native-quick-base64 for envelope encoding when available by alwx in #6314
  • fix(android): Prevent breadcrumb loss from numeric timestamp ClassCastException by antonis in #6308
  • chore(deps): update Android SDK to v8.44.0 by github-actions in #6310
  • chore(deps): update CLI to v3.5.1 by github-actions in #6305
  • chore(deps): update JavaScript SDK to v10.58.0 by github-actions in #6296
  • chore: Fix lint issues by antonis in #6300
  • chore: Bump sample and perf test apps to React Native 0.86.0 by antonis in #6287
  • fix(deps): bump form-data from 4.0.5 to 4.0.6 by antonis in #6297
  • fix(ci): Handle @sentry-internal/* package renames in JS updater by antonis in #6295
  • Record network request/response bodies in Session Replay by alwx in #6288
  • chore(deps): bump tar from 7.5.11 to 7.5.16 by dependabot in #6293
  • fix(ci): Update renamed @sentry-internal/* packages in JS updater script by antonis in #6294
  • chore(deps): bump launch-editor from 2.11.1 to 2.14.1 by dependabot in #6291
  • chore(deps-dev): bump @babel/core from 7.26.7 to 7.29.6 by dependabot in #6292
  • fix(deps): Resolve shell-quote to >=1.8.4 (Dependabot RNSentryModule.captureEvent is ignoring environment #547) by antonis in #6286
  • fix(ci): Support version catalog in android SDK version check by antonis in #6280
  • test(e2e): Bump E2E tests to React Native 0.86.0 by antonis in #6268
  • feat(android): Add nativeStackAndroid support to NativeLinkedErrors by lucas-zimerman in #6278
  • chore(deps): bump ruby/setup-ruby from 1.310.0 to 1.313.0 by dependabot in #6282
  • chore(deps): update Maestro to v2.6.1 by github-actions in #6277
  • chore(deps): bump gradle/actions from 6.1.0 to 6.2.0 by dependabot in #6284
  • chore(deps): bump getsentry/craft from 2.26.8 to 2.26.10 by dependabot in #6283
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.8 to 2.26.10 by dependabot in #6281
  • chore(deps): update Sentry Android Gradle Plugin to v6.11.0 by github-actions in #6275

Plus 5 more


🤖 This preview updates automatically when you update the PR.

alwx added a commit that referenced this pull request Jun 18, 2026
Link to the PR (#6314) instead of the issue, drop the unverified "~10x"
figure (we have not benchmarked locally), and match the terser phrasing
used by the closest analogue (#4874, the TextEncoder envelope entry).
alwx added 2 commits June 18, 2026 11:31
…available

Adds `react-native-quick-base64` as an optional peer dependency. When the
package is installed by the consumer, envelope payloads are base64-encoded
via its native JSI implementation (~10x faster than the bundled JS
encoder). When it is absent, the SDK transparently falls back to the
existing `base64-js`-derived encoder in `vendor/base64-js` — no behavior
change for users who do not opt in.

The encoder is resolved once at first use and cached, so the optional
`require` runs at most once per session. Base64 encoding is on the hot
path of `RNSentry.captureEnvelope` and is most impactful for large
envelopes (profiles, attachments, replays).

Closes #4884.
Link to the PR (#6314) instead of the issue, drop the unverified "~10x"
figure (we have not benchmarked locally), and match the terser phrasing
used by the closest analogue (#4874, the TextEncoder envelope entry).
@alwx alwx force-pushed the alwx/feature/base64-quick-base64 branch from f64591a to 383df08 Compare June 18, 2026 09:34
@github-actions

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 383df08

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.

Use CPP Base64 Encoder for better performance (>10x)

1 participant