-
Notifications
You must be signed in to change notification settings - Fork 325
Support custom preparationBatchSize defined via SourceKit's options #2294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for picking this up @josh-arnold-1 🙏. One high-level comment: I would really like us to design the configuration option that allows us to customize the batching strategy as I described in #2238 (comment). do you think you could look into that? |
Thanks for the review! What if we update the schema to be an enum of configuration options like you specified, but we just supply a single option for now, which we default to a target size of 1 to maintain SourceKit-LSPs default behavior? That way, we can easily extend additional strategies in future PRs, whilst maintaining the current configuration API? What are your thoughts? Thanks! |
|
Your proposal for the JSON schema sounds great to me! |
|
Is there a way to set |
Setting to a high value seems reasonable to me for this rather than handling it specifically |
|
Sorry for the delayed response — I was OOO recently. I’m looking into this now and realized that config.schema.json generation might not support enums with associated values (unless I’m missing something?). If that’s the case, what would be the best way to represent the different batching strategies? @ahoppen, any guidance here would be super helpful. Thanks! |
|
Yeah, the JSON schema generation would need to be expanded to support this. That’s what I meant in #2238 (comment).
|
b8a8cad to
5cd67b8
Compare
|
Thanks @ahoppen, I just updated the code with what we discussed! |
ahoppen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I really appreciate that you put in the effort to generate the enum options in the JSON schema and Markdown document 🙏🏽 Just a few nitpicky comments.
Two other high-level comments:
- Could you include the test from #2238 in this PR as well?
- I would also like to see the BSP server advertising if it can handle multi-target preparation as I mentioned in #2238 (comment) so that users can’t get regressed performance for SwiftPM projects by increasing the target batch size. #2238 already implements most of this, so you should be able to just copy it. I would be happy for this to be follow-up PR though so we can get this one in without any further discussions on the BSP protocol extension.
SourceKitLSPDevUtils/Sources/ConfigSchemaGen/OptionDocument.swift
Outdated
Show resolved
Hide resolved
5cd67b8 to
dc49728
Compare
|
Sorry for the month-long hiatus, I was quite strapped for time. I tried to respond to all the comments, please let me know if I missed anything! Thanks @ahoppen for your time reviewing this 🙏 |
ahoppen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries with the delay and thanks again for your work on this. I have two nitpicky comments, but I’d be happy to merge this as-is as well and address those in follow-up PRs.
| var trimmed = line | ||
| while trimmed.first?.isWhitespace == true { | ||
| trimmed = trimmed.dropFirst() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could just be
| var trimmed = line | |
| while trimmed.first?.isWhitespace == true { | |
| trimmed = trimmed.dropFirst() | |
| } | |
| var trimmed = line.drop(while: \.isWhitespace) |
| "markdownDescription" : "Defines the batch size for target preparation. If nil, defaults to preparing 1 target at a time.", | ||
| "oneOf" : [ | ||
| { | ||
| "description" : "Prepare a fixed number of targets in a single batch. `batchSize`: The number of targets to prepare in each batch.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t we get markdownEnumDescriptions in here as well? I suspect that it’s just something stupid that’s stopping it from appearing.
|
@swift-ci Please test |
|
@swift-ci Please test Windows |
What
Follow up from this issue here: #2238
Allow projects to define a custom
preparationBatchSizein their projects. This can be incredibly useful for my large Bazel based project.Currently, I've only supported a
targetstrategy which allows you to define a constant batch size. We can easily extend this in the future for multiple strategies.Usage
Test plan
Tested locally in my project.