[TIMOB-7813] Android: Interval - v8 only - When running through the platform tab in KS, set interval becomes very slow and jumpy
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-08T11:21:19.000+0000 |
Affected Version/s | Release 1.8.2 |
Fix Version/s | Sprint 2012-05, Release 2.0.0 |
Components | Android |
Labels | qe-and021312, regression, release-note-2.0.0 |
Reporter | Natalie Huynh |
Assignee | Bill Dawson |
Created | 2012-02-25T10:50:19.000+0000 |
Updated | 2012-03-12T11:06:03.000+0000 |
Description
Steps to Reproduce:
1. Launch KS > Platform > Set Interval (timer)
2. Let the test run up to 1000, back and restart
3. Repeat step 2 until the test because slow and jumpy (~10-15 times)
Actual:
The set interval is slow and jumpy
Expected:
The set interval should be fast and not jumpy
Note:
Restarting KS and just going to Set Interval test you do not encounter the issue.
Additional info: Just running the Set Interval and timing how long it takes to hit 1000, increments each time the test is re-ran 1st: 22.19 seconds 2nd: 29.29 seconds 3rd: 31.86 seconds When ran with 1.8.1 it takes ~ 10 seconds each run even after relaunch
Interestingly, it doesn't appear to happen with 1.8.1. So something between 1.8.1 and the version you mention in the description (from Feb 3rd, when the master branch was still 1.9.0) has caused this. I've also confirmed that it happens on the current (2.0.0) master branch and on the current (1.8.2) 1_8_X branch. Still investigating.
I've got it down to the line of code: https://github.com/appcelerator/titanium_mobile/blob/da5c15399033ed7c3a257fbc2cc141f4a0311a67/android/runtime/v8/src/java/org/appcelerator/kroll/runtime/v8/V8Runtime.java#L74 This is central to our memory management. I'll have to discuss with Josh.
An easy way to re-create for testing: On the platform tab, just go into and out of XHR 10 times (or more if you want to see the delay more). You don't even need to do anything once you get to the XHR window. Just in and out. Do it 20 times, then run to the Set Interval test. It has nothing to do with the XHR tests, of course. You can go into any submenu of tests 10 times (even on a tab different than Platform) and see the same behavior. So it's like it's related to the number of objects that the idle time GC check in v8 has to examine, or something like that.
This is a blocker for several apps I am working on...
PR ready https://github.com/appcelerator/titanium_mobile/pull/1577 We thereby reduce the impact of V8 GC calls. However since there is only one runtime thread, anything on that thread (Javascript calls, the V8 GC, etc.) that takes longer than a setInterval's interval will end up pushing back that interval a bit. (To put another way: the setInterval callback cannot be called until the runtime thread is free.)
Tested on Nexus Galaxy 4.0.2 takes ~10 second to get to 1000 on every relaunch