Skip to content

Applying build tool plugin is slow and causes OOM errors with large SPM dependency graph #709

Description

@tylerjonesio

Steps to reproduce

I've got a rather large project that I'm incorporating Skip (SkipFuse) into. It has 10 local swift packages with 40+ targets and a decent amount of external dependencies as well. When building the app, the Applying build tool plug-in "skipstone" steps gets applied to 36 different targets. When running a skip enabled build the build tool plugin step would take a long time (multiple minutes) and in some instances cause an OOM and make my machine lock up.

Unfortunately this is a private project and I can't share the code to test with but I have done a little bit of investigation below to what the cause might be.

Actual results

This large dependency graph seems to causes issues with the skip/skipstone build plugin. In a previous iteration of my app the build tool plugin run could take 1-2 mins just by itself.

Image

After a recent change of packaging (to incorporate more umbrella libraries vs individual target exports), the build ballooned this time to 5+ mins and would frequently cause my machine (M4 Max) to run out of ram before it ever finished. And because this build tool plugin gets run for the initial iOS build and the Android build, the amount of time becomes very cumbersome.

Image Image

Findings and Potential Fix

I did a little bit of investigation with the help of Codex, and this issue seems to be largely caused by a recursive transversal of the package graph. Without any type of memory, this function seems to just spin and spin with my project.

I had codex take a stab at fixing it and the resulting fix was crazy fast in comparison!
Image

The change is relatively small. I'm happy to open a PR with this if it deemed worthy. I was just hesitant as I'm not super familiar with this underlying plugin code and if there could be any potential side effects.

Logs

Logs
<!-- Paste your logs here -->

Skip Checkup output

Checkup output
[✓] Skip version 1.9.4 (= 1.9.4)
[✓] macOS version 26.5.2 (> 13.5.0)
[✓] macOS architecture: ARM
[✓] Swift version 6.3 (> 5.9.0)
[✓] Swiftly version 1.1.3 (> 1.0.0)
[✓] Xcode version 26.6 (> 15.0.0)
[✓] Xcode tools SDKs: 5
[✓] Homebrew version 6.0.11 (> 4.1.0)
[✓] Gradle version 9.6.1 (> 8.6.0)
[✓] Java version 26.0.1 (> 17.0.0)
[✓] Android Debug Bridge version 1.0.41 (> 1.0.40)
[✓] Android SDK version 37.0.0 (> 29.0.0)
[✓] Resolve dependencies (14.21s)
[✓] Build hello-skip (31.11s)
[✓] Test Swift (9.89s)
[✓] Test Kotlin (48.62s)
[✓] Check project schemes (4.11s)
[✓] Archive iOS ipa (7.61s)
[✓] Assemble HelloSkip-debug.ipa 173 KB
[✓] Verifying HelloSkip-debug.ipa: 173 KB
[✓] Assembling Android apk (80.05s)
[✓] Verify HelloSkip-debug.apk: 84.7 MB
[✓] Check Skip Updates: 1.9.4
[✓] Skip 1.9.4 checkup succeeded in 197.61s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions