React Native最大60fps下为何事件处理耗时仅1.01ms?
Great question—this is such a common gotcha when digging into React Native's bridge and thread mechanics! Let me break down exactly why you're seeing that surprisingly low ~1.01ms latency instead of the 0–16.67ms range you expected:
The JS thread's 60fps cycle doesn't block bridge events
The 16.67ms frame limit applies only to the JS thread's rendering loop (the work that updates the UI each frame). When you call[self sendEventWithName: body:], the native side sends the event to the React Native bridge immediately—it doesn't wait for the next JS frame to start. If the JS thread isn't busy with rendering, layout, or other heavy tasks, it can pick up and process the event the moment it arrives across the bridge. That 1.01ms is likely the raw transit time of the event plus minimal processing overhead when the JS thread is idle.Your timestamp comparison measures bridge transit, not frame alignment
When you capture[[NSDate date] timeIntervalSince1970]on the native side, you're marking when the event leaves native code. TheDate.now()in JS captures when the JS runtime receives the event, not when it's scheduled into a render frame. If the JS thread is free, there's no delay—this is why your delta is so small. The 0–16.67ms spread would only show up if the event arrives while the JS thread is mid-frame task (like rendering a complex component), forcing it to wait until the next cycle to process the event.Small payloads and fast hardware minimize overhead
The iPhone SE (even older models) has a capable CPU, and if your test event has a tiny payload, the serialization/deserialization work the bridge does is negligible. This cuts down on any extra time that might be added by processing larger data.
Quick Test to See the Expected Range
If you want to reproduce that 0–16.67ms latency spread, try running a heavy JS task (like looping through a large array or updating a complex UI) at the exact same time you send the native event. You'll see the latency jump as the event waits for the JS thread to finish its current frame work before being processed.
内容的提问来源于stack exchange,提问作者Martin Mlostek

