BeamApp / Transit

Library to Bridge between JavaScript and iOS, OSX, Android
Other
150 stars 13 forks source link

Reconsider polling approach for performance reasons #23

Open mrcljx opened 11 years ago

mrcljx commented 11 years ago

Currently each first (i.e. non-reentrant) request from Native to JS causes this behavior:

Thus the following piece of code takes ~7200ms (on Samsung Galaxy Android 4.2.2) to run where 1000 sequential calls from JS to Native only take ~4000ms.

for (int i = 0; i < 1000; i++) {
  transit.eval("someJSFunction()");
}

This could be optimized by moving the EVAL-Payload to the loadUrl directly.

HBehrens commented 11 years ago

Do you have the chance to measure the impact of loadUrl and prompt separately? If I understand the flow correctly the example above does one loadUrl and two prompts (first to receive package, second to deliver results and ensure "end of poll"). Putting the initial job into the request would eleminate the first prompt then. Is this worth the redesign and risk that the URL's length exceeds any 4k (or similar) limits?

HBehrens commented 11 years ago

How does this ticket relate to the recent improvements mentioned in #2 ?

mrcljx commented 11 years ago

This issue remains in the "to discuss" category - didn't change the poll-design for now (also the Trigger.io benchmark doesn't cover the 1000 calls inited by Java case).