Skip to content

[2.x] perf: Don't re-convert the classpath in withBootclasspath - #1834

Open
hoangmaihuy wants to merge 1 commit into
sbt:developfrom
hoangmaihuy:perf/bootclasspath-pass-through
Open

hoangmaihuy wants to merge 1 commit into
sbt:developfrom
hoangmaihuy:perf/bootclasspath-pass-through

Conversation

@hoangmaihuy

Copy link
Copy Markdown
Contributor

Disclaimer: Developed with Claude Code with human review in the loop

Fixes #1833

Change

Reuse the entries that were passed in, and convert only the paths finishClasspath adds

Verification

sbt built against this zinc: sbt develop (0a70458a4) built against 2.1.0-M5 (before) and against this branch (after), on sbt-compile-benchmark's scale-big (81 modules in three chains of 27, ~640 class files each), macOS. Medians of 8 interleaved rounds; sbt 1.13.0 ran the same rounds alone afterwards, for reference:

sbt 1.13.0 before after
edit chain root m1 1.10 s 6.23 s 2.25 s
edit leaf app 1.15 s 2.75 s 1.94 s
no-op 1.10 s 1.92 s 1.94 s

In a wall-clock profile of the chain-root edit, work under withBootclasspath falls from 4.1 thread-seconds per edit to 0, and total work from 8.7 to 4.8.

withBootclasspath turned the VirtualFile classpath it was given back into
paths and converted each one again. With sbt 2's MappedFileConverter every
class directory on the classpath is listed again on every compile. Reuse the
entries that were passed in and convert only the paths finishClasspath adds.

Generated-by: Claude Opus 5.5 (Claude Code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dtk5cyfJFa66ZRoKprmT6
@hoangmaihuy

Copy link
Copy Markdown
Contributor Author

Benchmark smoke test failed due to connection reset when fetching artifacts, not related to this PR changes

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.

[2.x] withBootclasspath converts the classpath it is given all over again

1 participant