You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Andrew Grieve (JIRA)" <ji...@apache.org> on 2012/10/03 22:06:07 UTC
[jira] [Created] (CB-1579) Optimize exec() calls made from plugin
callbacks on iOS
Andrew Grieve created CB-1579:
---------------------------------
Summary: Optimize exec() calls made from plugin callbacks on iOS
Key: CB-1579
URL: https://issues.apache.org/jira/browse/CB-1579
Project: Apache Cordova
Issue Type: Improvement
Components: iOS
Reporter: Andrew Grieve
Assignee: Andrew Grieve
Fix For: 2.2.0
Using stringByEvaluatingJavascriptString is super fast, and using and XHR / iframe navigation is really slow. The idea here that whenever the native side does a stringByEvaluatingJavascriptString call, to use its return value to bundle the actual return value along with any pending js->native messages
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-1579) Optimize exec() calls made from plugin
callbacks on iOS
Posted by "Andrew Grieve (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-1579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13468785#comment-13468785 ]
Andrew Grieve commented on CB-1579:
-----------------------------------
My initial prototype shows the exec() benchmark goes from 300 calls/sec (using IFRAME_NAV) to 800 calls/sec.
> Optimize exec() calls made from plugin callbacks on iOS
> -------------------------------------------------------
>
> Key: CB-1579
> URL: https://issues.apache.org/jira/browse/CB-1579
> Project: Apache Cordova
> Issue Type: Improvement
> Components: iOS
> Reporter: Andrew Grieve
> Assignee: Andrew Grieve
> Fix For: 2.2.0
>
>
> Using stringByEvaluatingJavascriptString is super fast, and using and XHR / iframe navigation is really slow. The idea here that whenever the native side does a stringByEvaluatingJavascriptString call, to use its return value to bundle the actual return value along with any pending js->native messages
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CB-1579) Optimize exec() calls made from plugin
callbacks on iOS
Posted by "Andrew Grieve (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-1579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrew Grieve resolved CB-1579.
-------------------------------
Resolution: Fixed
The biggest win was just removing setTimeout(0) when dispatching plugin results.
Results in a 3x gain in IFRAME_NAV and a 6x gain in XHR_NO_PAYLOAD *when* exec() is called from a plugin result callback.
In the normal case (when exec() is called not from the context of a plugin result), the speedup is 66% for IFRAME_NAV and 33% for XHR_NO_PAYLOAD.
Here are the benchmarks on my iPad 2:
Base:
Commit: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=1a4156931a3697c1b47fbfe806f5ba69b1655aa1
IFRAME_NAV: 300
XHR_NO_PAYLOAD: 150
XHR_WITH_PAYLOAD: 190
IFRAME_NAV+async: 143
XHR_NO_PAYLOAD+async: 120
XHR_WITH_PAYLOAD+async: 110
Delete setTimeout in callback result:
Commit: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=c8ac3c2607e9b0dd7d00898e1276337eeaa10044
IFRAME_NAV: 800-900
XHR_NO_PAYLOAD: 830-880
XHR_WITH_PAYLOAD: 350 (not sure why this one was slow)
IFRAME_NAV+async: 200-300
XHR_NO_PAYLOAD+async: 150
XHR_WITH_PAYLOAD+async: 200
Check for new exec() in callback.
Commit: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=ba7d771306a51c180da7a5541c4738f08a8cac4d
IFRAME_NAV: 950-1000
XHR_NO_PAYLOAD: 980-1000
XHR_WITH_PAYLOAD: 980-1000
IFRAME_NAV+async: 250-260
XHR_NO_PAYLOAD+async: 150-175
XHR_WITH_PAYLOAD+async: 200
Delete cordova.commandQueueFlushing (no change in performance)
commit: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=de046f7ae64421d69fd52befd2b5fd3c351ac28a
Add runloop delay to fix alert()s (no change in performance)
(commit a part of previous one)
Other relevant commits:
JS change: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commit;h=99fed6dce70a6c6c6a666a72e6a812e595855f18
Updating core plugins to use new plugin results methods:
https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=035e2fb9bc76052a54f12b71648daba980af08fa
> Optimize exec() calls made from plugin callbacks on iOS
> -------------------------------------------------------
>
> Key: CB-1579
> URL: https://issues.apache.org/jira/browse/CB-1579
> Project: Apache Cordova
> Issue Type: Improvement
> Components: iOS
> Reporter: Andrew Grieve
> Assignee: Andrew Grieve
> Fix For: 2.2.0
>
>
> Using stringByEvaluatingJavascriptString is super fast, and using and XHR / iframe navigation is really slow. The idea here that whenever the native side does a stringByEvaluatingJavascriptString call, to use its return value to bundle the actual return value along with any pending js->native messages
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira