Bridge Message Queue Priority Configuration for Concurrent Native Modules
0 reputation · 14 May 2020, 22:39 UTC
Context
The legacy React Native bridge serializes all native-to-JS messages through a single FIFO queue on the JavaScript thread. When multiple native modules (network, Bluetooth, sensors, timers) fire concurrent events, their callbacks compete equally for the same event-loop tick, making latency for time-sensitive updates non-deterministic.
Constraint Gap
No public API exists to assign priority, batching hints, or dedicated lanes to specific native modules. The newer Fabric architecture introduces synchronous JSI calls but still funnels asynchronous events through a shared scheduler without exposing cross-module prioritization. Hermes garbage-collection pauses further amplify latency spikes when the queue backs up.
Open Questions
- Is there a supported mechanism to mark certain native-module event streams as high-priority so they bypass lower-priority queued messages?
- Can TurboModule registration include scheduler hints (e.g., lane model or priority level) that the Fabric runtime respects for asynchronous callbacks?
- What profiling strategy reliably isolates bridge serialization overhead from JavaScript parsing cost and native-module contention in a production build?