Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider polling approach for performance reasons #23

Open
mrcljx opened this issue Feb 18, 2013 · 3 comments
Open

Reconsider polling approach for performance reasons #23

mrcljx opened this issue Feb 18, 2013 · 3 comments

Comments

@mrcljx
Copy link
Member

mrcljx commented Feb 18, 2013

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

  • Client calls transit.eval(...)
  • Transit.java pushes EVAL-Job to the actions stack
  • Transit.java triggers transit.poll() in Transit.js via loadUrl
  • Transit.js does a prompt(POLL)
  • Transit.java pops EVAL-Job from the actions stack and...
  • Transit.js receives EVAL-Job
  • Transit.js processes EVAL-Job
  • Transit.js returns result of EVAL-Job
  • Transit.java creates a NULL-Job and...
  • Transit.js receives a null-Job (end of poll)
  • Client receives result of EVAL

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.

@ghost ghost assigned mrcljx Feb 18, 2013
@HBehrens
Copy link
Member

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
Copy link
Member

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

@mrcljx
Copy link
Member Author

mrcljx commented Feb 20, 2013

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants