-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: add batch size cli arg and config option #335
Conversation
@michaelpj You could try the Reducing the batch size to You can also set it via config using |
b9f36ee
to
445a873
Compare
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.
Sounds good, just added the missing doc
@zimbatm if we deploy this though, the docs site will update with a feature that is not released... I'm currently looking into versioned docs with vitepress. |
Should batch size be a per-formatter option? The optimal batch size may well depend on the formatter. |
Paths to be formatted are batched according to a batch key unique to the sequence of formatters that matched against that path. Take the following config, for example: [formatter.foo]
includes = ["foo/*.txt"]
[formatter.bar]
includes = ["bar/*.txt"]
[formatter.baz]
includes = ["*.txt"]
Formatters are sorted by If we allow specifying a batch size per formatter in addition to the global batch size, it would have no effect if it was greater than the global batch size. Still, it could help optimize the application of a given batch to a given formatter. If we remove the global batch size and instead rely solely upon a batch size per formatter, I think things start to break down. So yeah, I can see value in an additional batch size option on a per-formatter basis. It would allow breaking batches into smaller chunks that are easier to swallow for certain formatters within the sequence, and we could parallelize the application too. I'll find time to add it to this PR in the next few days. |
@michaelpj I did a quick spike here so you can use this branch if you want to play around with configuring smaller batch sizes for [formatter.ormolu]
...
batch_size = 128 |
Controls the max number of paths to batch up before applying them to a sequence of formatters. Signed-off-by: Brian McGee <[email protected]>
Signed-off-by: Brian McGee <[email protected]>
f506357
to
106340c
Compare
This is too stale, I'll re-implement on top of latest main |
Controls the max number of paths to batch up before applying them to a sequence of formatters.
Works through a
--batch-size
cli arg or via config:Note
The cli arg takes precedence over the config option
TODO
Closes #334
Signed-off-by: Brian McGee [email protected]