Skip to content

android: writeLog perf improvements - #882

Open
snowp wants to merge 3 commits into
mainfrom
map-types
Open

android: writeLog perf improvements#882
snowp wants to merge 3 commits into
mainfrom
map-types

Conversation

@snowp

@snowp snowp commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented Feb 12, 2026

Copy link
Copy Markdown

Size Comparison Report (x86_64)

Metric APK (KB) SO (KB)
Baseline 3427 1292
Current 3427 1292
Difference 0 0

APK size unchanged. SO size unchanged.

@github-actions

github-actions Bot commented Feb 12, 2026

Copy link
Copy Markdown

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 924 923 +0.1%
logNotMatched5000Fields 10 10 0.0%
logNotMatchedNoFields 1 1 0.0%
trackSpansWithFields 140 140 0.0%
trackSpansWithoutFields 55 54 +1.9%
webViewBridgeBridgeReady 60 60 0.0%
webViewBridgeCustomLog 61 65 -6.2%
webViewBridgeInvalidJson 38 38 0.0%
webViewBridgeWebVitalCLS 178 176 +1.1%

Timing

Test PR main Δ
logHttpNetworkLog50FieldsAndHeadersAndFieldProviders 247.82 us 241.00 us +2.8%
logNotMatched5000Fields 2.49 ms 2.46 ms +1.5%
logNotMatchedNoFields 381 ns 459 ns -16.9%
trackSpansWithFields 487.04 us 476.97 us +2.1%
trackSpansWithoutFields 7.86 us 7.75 us +1.4%
webViewBridgeBridgeReady 8.21 us 8.05 us +2.0%
webViewBridgeCustomLog 12.49 us 8.83 us +41.4%
webViewBridgeInvalidJson 100.80 us 165.91 us -39.2%
webViewBridgeWebVitalCLS 21.73 us 20.50 us +6.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