Skip to content

Reconsider polling approach for performance reasons #23

@mrcljx

Description

@mrcljx

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions