Skip to content

android: writeLog perf improvements#882

Open
snowp wants to merge 5 commits intomainfrom
map-types
Open

android: writeLog perf improvements#882
snowp wants to merge 5 commits intomainfrom
map-types

Conversation

@snowp
Copy link
Contributor

@snowp snowp commented Feb 12, 2026

Adds two performance optimizations that should help the inline overhead of logging on Android:

  • Pass null instead of empty arrays when there are no fields/matching fields. This allows us to skip the JNI calls for empty arrays
  • Manually manage the JNI local references instead of using a local frame, which seems to perform better due to not having to create lots of local frames during field conversion

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

@github-actions
Copy link

Size Comparison Report (x86_64)

Metric APK (KB) SO (KB)
Baseline 3370 1244
Current 3370 1244
Difference 0 0

APK size unchanged. SO size unchanged.

@github-actions
Copy link

github-actions bot commented Feb 12, 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 915 916 -0.1%
logNotMatched10Fields 17 18 -5.6%
logNotMatched5000Fields 46 45 +2.2%
logNotMatched500Fields 30 46 -34.8%
logNotMatched5Fields 11 14 -21.4%
logNotMatchedNoFields 1 1 0.0%
trackSpansWithFields 135 135 0.0%
trackSpansWithoutFields 55 56 -1.8%
webViewBridgeBridgeReady 61 62 -1.6%
webViewBridgeCustomLog 66 66 0.0%
webViewBridgeInvalidJson 38 38 0.0%
webViewBridgeWebVitalCLS 115 115 0.0%

Timing

Test PR main Δ
logHttpNetworkLog50FieldsAndHeadersAndFieldProviders 235.00 us 234.09 us +0.4%
logNotMatched10Fields 5.75 us 5.77 us -0.4%
logNotMatched5000Fields 2.32 ms 2.25 ms +3.0%
logNotMatched500Fields 352.78 us 238.56 us +47.9%
logNotMatched5Fields 3.18 us 3.20 us -0.6%
logNotMatchedNoFields 361 ns 446 ns -19.2%
trackSpansWithFields 487.27 us 481.08 us +1.3%
trackSpansWithoutFields 7.67 us 7.63 us +0.5%
webViewBridgeBridgeReady 7.92 us 7.87 us +0.5%
webViewBridgeCustomLog 8.62 us 8.57 us +0.6%
webViewBridgeInvalidJson 83.37 us 139.79 us -40.4%
webViewBridgeWebVitalCLS 15.88 us 15.57 us +2.0%

@snowp snowp changed the title writeLog perf improvements android: writeLog perf improvements Feb 12, 2026
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