Why not use JSExport to implement the bridge?
I found that the js-to-native bridge is implemented by calling BatchedBridge.callFunctionReturnFlushedQueue from native continuously, thus "flush" the ModuleID,MethodId,CallbackID and arguments to native.
Does this mean eating up a lot of battery life?
Why not use JavascriptCore's JSExport protocol to implement the bridge ?
Thanks :)
/cc @jordwalke @sahrens
I observed memory corruption with JSExport on iOS7. It was very difficult to reproduce, but when I finally reproduced it I rewrote it in terms of serialized strings. If anything, we should eventually just use the raw JSC c API, but IIRC flushing/serializing is not the bottleneck (if you see otherwise, please let us know). In fact, in one benchmark @frantic and I found that just copying the entire data at once was faster than using micro-hooks to convert each piece of the data using the JSC c API - it might have something to do with crossing the JS/native boundary several times vs. in one batch.
Now using JSC C api as per #1037