Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6990] iOS: Change KrollContext to use a single GCD serialized queue

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-09T19:36:23.000+0000
Affected Version/sRelease 1.8.0.1, Release 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelscore
ReporterStephen Tramer
AssigneeAlan Hutton
Created2012-01-04T18:39:37.000+0000
Updated2020-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.

Comments

  1. Stephen Tramer 2012-02-07

    Bumping to next sprint to continue work there.
  2. Blain Hamon 2013-03-26

    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.

JSON Source