Skip to content

Conversation

@snowp
Copy link
Contributor

@snowp snowp commented Dec 19, 2025

Before this change a number of fields would be passed through to the Rust layer on every log call, resulting in extra JNI calls and string allocations. This PR moves a number of these fields into Rust allowing us to store them as reusable strings.

This also has the benefit that we can read these directly during crash reporting and not pass these through from the platform layer


  • CHANGELOG.md's "Unreleased" section has been updated, if applicable.

@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Size Comparison Report (x86_64)

Metric APK (KB) SO (KB)
Baseline 3374 1252
Current 3374 1252
Difference 0 0

APK size unchanged. SO size unchanged.

@snowp snowp force-pushed the avoid-static-field-conversion branch 5 times, most recently from 5ff1732 to 8cbf009 Compare December 29, 2025 19:47
@snowp snowp changed the title android: avoid marshaling static fields through JNI on every log call android/ios: move static fields into Rust layer Jan 2, 2026
@snowp snowp force-pushed the avoid-static-field-conversion branch from 8a95e1b to 9ceff13 Compare January 5, 2026 17:59
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

Android Benchmark Results

Device: PR: Emulator - Android SDK built for x86_64 (API 31) | main: Emulator - Android SDK built for x86_64 (API 31)

Note: Benchmarks run on emulator. Results may vary between runs and may differ from physical devices.

Allocations

Test PR main Δ
logHttpNetworkLog50FieldsAndHeadersAndFieldProviders 1088 1043 +4.3%
logNotMatched10Fields 20 19 +5.3%
logNotMatched5000Fields 143 160 -10.6%
logNotMatched500Fields 143 132 +8.3%
logNotMatched5Fields 15 15 0.0%
logNotMatchedNoFields 1 1 0.0%
trackSpansWithFields 329 316 +4.1%
trackSpansWithoutFields 57 56 +1.8%

Timing

Test PR main Δ
logHttpNetworkLog50FieldsAndHeadersAndFieldProviders 242.55 us 237.80 us +2.0%
logNotMatched10Fields 6.65 us 6.63 us +0.3%
logNotMatched5000Fields 2.71 ms 2.71 ms 0.0%
logNotMatched500Fields 277.70 us 277.69 us +0.0%
logNotMatched5Fields 3.68 us 3.75 us -1.8%
logNotMatchedNoFields 509 ns 545 ns -6.6%
trackSpansWithFields 564.98 us 563.59 us +0.2%
trackSpansWithoutFields 8.36 us 8.32 us +0.5%

@snowp snowp marked this pull request as ready for review January 5, 2026 20: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.

2 participants