[TIMOB-6990] iOS: Change KrollContext to use a single GCD serialized queue
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-01-09T19:36:23.000+0000 |
Affected Version/s | Release 1.8.0.1, Release 2.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | core |
Reporter | Stephen Tramer |
Assignee | Alan Hutton |
Created | 2012-01-04T18:39:37.000+0000 |
Updated | 2020-01-09T19:36:23.000+0000 |
Description
Just as the bug description says, we should change
KrollContext
to use a single GCD serial queue (or NSOperationQueue
). Here's what we get from this:
* Reduced complexity
* Speed improvement (no more signaling/blocking/locking for events, they can just go straight into the serial queue)
* Reduced chance of cross-context bugs (due to execution ordering)
* The ability to call JS from the main thread! (critical for implementing the layout spec, listcontroller/tableview2, and concurrency) Note that this doesn't guarantee "no deadlocks" or "no bad blocking behavior" or even "no crashes due to iOS main thread demands" in the case where the JS must call methods on the main thread (as always) but we can mitigate this with GCD as well.
This essentially allows us to collapse our multiple context threads into a single thread for JSCore.
*NOTE:* May need to be rescheduled depending on QE impact to avoid resets. But we do need this before work on layout or other critical 1.9.0 features begins.
Bumping to next sprint to continue work there.
Honestly, I'm not sure if this is the proper solution. We should look into: * If this actually gets us a performance boost * If we still can control and do proper garbage collection interleaving actions * Whether or not JS deadlocks will occur * Whether or not we could have this main logic be cross-platform; GCD closes this option * How compatible it is with webworkers I'm not disputing that we should revisit KrollContext. But I'm not sold that this is the solution.