-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
black performance scales non-linearly with the number of files to process #1951
Comments
Good find! From looking at the code it appears we shouldn't write to the cache multiple times per run, so there must be some other superlinear behavior going on. Does it reproduce with your patch for #1950? |
oh yeah I should have checked, yeah it does so my guess at the cache being at fault is probably incorrect |
I had some spare time and after some profiling it looks like |
In fact, adding an |
I wonder if we should just use If so, we could bring out the big guns and use https://aioitertools.omnilib.dev/en/latest/api.html#aioitertools.asyncio.as_completed and https://aioitertools.omnilib.dev/en/latest/api.html#aioitertools.more_itertools.chunked |
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
I suspect this is related to #1950 -- or at least exacerbated by it
setup
1000 files
10000 files
I expect the second command to be approximately 10x slower than the first, however it's almost 30-40x worse
A guess is black is writing the cache for every single file and should instead batch it per run
Expected behavior A clear and concise description of what you expected to happen.
Environment (please complete the following information):
Does this bug also happen on master? To answer this, you have two options:
yes
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: