
Low performance of NativeMessaging API in Firefox compared to Chromium (dozens of times slower)
Description: We have encountered a significant performance issue with NativeMessaging API in Firefox when an extension communicates with a native application.
In scenarios where many objects must be enumerated (e.g., ~458 certificates), Firefox is dozens of times slower than Chromium-based browsers.
Environment:
Firefox (latest stable, reproduced in 2025)
Windows 11 x64
Same machine and same native plugin tested in Chrome, Edge, Yandex Browser
Steps to Reproduce:
Create a WebExtension that communicates with a native application via NativeMessaging.
Perform enumeration of a large number of objects (≈ 450–500).
Measure execution time in Firefox vs Chromium.
Actual results:
Firefox: enumeration of 458 objects takes ~2 min 30 sec
Chromium/Edge/Yandex Browser: enumeration of the same 458 objects takes ~5 sec
Additional tests: Round-trip time (RTT) for a single message:
Firefox: ~73.7 ms
Chromium: ~0.3 ms
Because the extension and the plugin exchange a large number of messages, this performance gap becomes critical.
Expected results: NativeMessaging API in Firefox should perform at a level comparable to Chromium browsers, so that extensions relying on heavy message exchange remain usable.
References: Bug 1288912 – Native messaging performance is extremely poor
Although this bug is marked as resolved, performance testing still shows a major discrepancy in the current versions of Firefox.
Question: Is there any ongoing work or plan to optimize the implementation of NativeMessaging API in Firefox to address this performance issue?
ప్రత్యుత్తరాలన్నీ (2)
Could you report it on https://bugzilla.mozilla.org ? That old bug is closed.
It would be nice to attach a perf profile to your bug.
Thanks.
TyDraniu said
Could you report it on https://bugzilla.mozilla.org ? That old bug is closed. It would be nice to attach a perf profile to your bug. Thanks.
Thank you for your quick response.
I noticed an interesting effect while testing with the profiler:
When I start "Record a performance profile", the enumeration of certificates (≈458 objects) completes much faster — about 1 minute.
When I do not enable profiling, the same operation takes about 5 minutes, as originally reported.
So, enabling performance profiling significantly reduces the delay, which looks unusual. It seems that recording a profile changes the timing/behavior of the NativeMessaging communication in Firefox.