Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
hannojg
added a commit
to callstackincubator/performance-analytics
that referenced
this pull request
Nov 30, 2026
This exposes the same per-thread measurement used in the [React Nitro release benchmark](margelo/nitro-ui#750) through the native Android SDK, with the same named-window API for React Native and React Nitro on Android and iOS. A harness can open a named window on any app thread and return its measurements directly to CI. ```ts const window = new ThreadBenchmark('read-items'); readItems(); const result = window.end(); ``` The calling thread owns the window. Ending it returns its OS thread ID, elapsed time and thread CPU time. On Android it also returns raw retired instructions and CPU cycles when the device permits access. The perf group opens only on explicit construction. CI gets availability, enabled time and running time for every group reading. Both JS adapters use the native SDK of their platform. ## Android Release validation The example instrumentation ran optimized Hermes bytecode on the main looper and hashed fixed SHA-256 blocks through the native SDK on the main looper and a worker. For example, Hermes and the native main window reported TID 6001 and the worker reported 6016. Ending a window on the other thread failed and the owner could still finish it. One native ARM64 ADC VM ran Android 15 with `armv8_pmuv3_0`, native bridge disabled and a non-debuggable target. Each block had two identical 8 MiB worker runs and one 12 MiB worker run. The main workload stayed at 8 MiB. Six blocks covered all six launch orders. The table shows median within-block changes relative to the first labeled 8 MiB control. All 54 windows had positive, equal enabled and running times. Both SHA-256 digests were independently verified on the host. | Window | A/A instructions | A/A cycles | Extra worker input, instructions | Extra worker input, cycles | | --- | ---: | ---: | ---: | ---: | | Hermes | +0.002% | +0.03% | -0.001% | +0.08% | | Main looper | +0.000% | -0.07% | +0.003% | +0.03% | | Worker | +0.003% | -0.07% | +49.939% | +49.60% | The JSON result also includes the monotonic duration from dispatch through completion of both native tasks. The example README includes the build and CI invocation. This draft targets Android artifact `0.2.0` for the next adapter release. ## React Native and iOS Release validation The React Native example ran without analytics setup on a native ARM64 Android 15 ADC VM. The checksum window reported 38,033,726 instructions and 17,502,998 cycles. The returned TID (5817) matched the OS thread named `mqt_v_js`. Enabled and running time were both 7,391,960 ns. On an iPhone 17e simulator running iOS 27.0, both Release apps returned the following results for the same checksum. These single observations verify the bindings. | Adapter | Darwin TID | Elapsed | Thread CPU | | --- | ---: | ---: | ---: | | React Native | 23184818 | 8.387 ms | 8.380 ms | | React Nitro | 23215891 | 5.864 ms | 5.862 ms | The iOS in-app result reports `countersAvailable: false` and `ENOTSUP`. A separate XCTest performance case requests CPU cycles and retired instructions using Apple’s thread-scoped `XCTCPUMetric`. CI can read available metrics from the xcresult bundle. This simulator returned only the clock metric. The Swift owner-thread and repeated-end assertions passed.
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our Android Harness tests check correctness. This adds an opt-in CI comparison between two Release builds. Both APKs embed the same benchmark, run on the same ADC device and take turns going first. The app times MMKV reads and React commits. The Callstack SDK records process CPU time and memory. CI saves the measurements and reports the intervals.
I calibrated it with identical code and a candidate doing 10.16% more MMKV reads. The runner checked both timing intervals at nine predefined points and stopped when their radii reached five percentage points.
One pair is two measured app starts. The Galaxy cleared the proposed +5% regression threshold. Its full Device Farm job took 5 min 17 s.
The manual hardware-counter mode runs 64 pairs and measures cycles and retired instructions on the Hermes thread. With 10.16% more MMKV reads, it measured 10.55% more cycles [+9.37%, +13.14%] and 10.1561% more instructions. The elapsed-time interval for the same launches was −2.27% to +23.41%. With identical code, the cycle interval was −1.39% to +1.28%.
Across both workloads, instruction counts reached the five-point precision target after 24 pairs (about 2 min 14 s), and cycles after 64 pairs (about 5 min 30 s), in a separate replay correcting for multiple looks. Both counter runs used fresh leases on the same native ARM64 ADC VM. The performance check is advisory. Measurement details and run commands
The harness now uses the published PerfKit 0.2.1 ThreadBenchmark API. Both Release APKs ran on native ARM64 ADC with the SDK from npm and GitHub Packages. All 16 MMKV and render windows from four positive-control pairs had full counter coverage. The calibration above was collected with the original prototype.
The follow-ups add reviewed fork runs in #773 and renderer, text input and scroll benchmarks in #774.