Skip to content

Fix: slow app launch under the debugger#131

Open
wellingtoncosta wants to merge 1 commit into
mainfrom
wp/fix-issue-128
Open

Fix: slow app launch under the debugger#131
wellingtoncosta wants to merge 1 commit into
mainfrom
wp/fix-issue-128

Conversation

@wellingtoncosta

Copy link
Copy Markdown

The plugin installed a regex breakpoint (BreakpointCreateByRegex on ^_Konan_init_*) on the dummy target to discover loaded Kotlin modules. Regex breakpoints can't use LLDB's name-accelerator index, so resolving one forces LLDB to realize the full symbol table of every module as it loads. An iOS app dlopens hundreds of frameworks at launch, so this ran on every debug session for every app — even ones with no Kotlin — roughly doubling launch time.

Replace it with lazy, stop-time discovery:

  • Scan loaded modules on stop, gating cheapest-first: skip system paths (no symtab touch), exact-name probe for the Kotlin runtime marker, and only deep-scan real Kotlin modules. ~99% of modules are eliminated by path alone.
  • Retry the ObjC base-class prefix read on later stops (the class_ro_t name pointer isn't rebased on the earliest stop), capped, with module-name formatters registered immediately.
  • Short-circuit steady-state stops to a single integer compare; retry window stays O(pending), not O(all modules).

Measured on WordPress app (41 frameworks), launch->UIApplicationMain, median of 5 interleaved runs: baseline 3.15s, old plugin 8.48s (2.70x), new plugin 3.11s (~baseline).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant