Hi,
Justin Lebar wrote [1] (it was about the FMRadio API):
> It's true that reading the |frequency| attribute causes a synchronous
> call up to the parent process. But as it turns out, we do a sync
> operation when reading all of the other attributes, as well. The
> parent process does no I/O upon receiving one of these messages.
>
> The issue isn't that a synchronous operation occurs, because that's
> how attributes work, but rather that we wait on a synchronous IPC
> message. This isn't free, but it's a lot cheaper than sync I/O.
>
> Certainly you shouldn't expect getting the frequency (or any of the
> other attributes) to be fast, however.
I wanted to get a feel of how bad this was.
I've tried the following on a Unagi on the remote console (talking to
the main Gaia process I think, not an app) with radio turned on and no
other app running:
function f(){
var radio = navigator.mozFMRadio;
var start = performance.now();
radio.frequency;
var end = performance.now();
console.log((end-start).toFixed(2), 'ms')
}
f()
~0.82ms against ~0.43ms for a normal property access (I did "f.length"
instead of "radio.frequency"). So it's not awful, but there is a
significant difference.
Can anyone tell me if my measurements done in a wrong way (so I'd get
baised results)?
Also, has anyone tried such perf measurements? on other devices?
David
[1]
https://bugzilla.mozilla.org/show_bug.cgi?id=779500#c147