Test speedups - #10042
Open
akx wants to merge 5 commits into
Open
Test speedups#10042akx wants to merge 5 commits into
akx wants to merge 5 commits into
Conversation
A test for sequence errors doesn't need compressed data
Contributor
Author
Contributor
Author
... huh, why would that fail on pypy only? 🤔 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

On my machine, this speeds up the entire test suite by ~8% on average, when running on all cores. (hyperfine)
test_apng_save_split_fdatwas spending time compressing data, but the premise of the test is to see whether large data is split across chunks correctly. So not compressing the data means it's faster and the data is larger, which is what that test cares about.test_parser()is split up with parametrization (or in the explicitly failing case of PDFs, into a separate test...), so the different formats run in parallel (Run tests in parallel with pytest-xdist #9945 and all that).convert_to_comparableusedget_flattened_datato convert a palette image to a list of numbers, just so it could be again interpreted asLbytes. Can just as well go with the bytes themselves (and Improve memory usage and performance fortobytes()#9938 will speed that up too).assert_image_similarnow usesImageChops.difference()to compute the difference map between 8bpp images in one multiband sweep. (This got faster in Speed up ImageChops operations #9738.) (ImageChopsfunctions don't do non-8bpp at all; I might take a look at that.) Since many of the tests end up doingassert_image_similar, that's a nice win. (Improve memory usage and performance fortobytes()#9938 will speed upassert_image_equal.) This is probably the source of most of the speedup here. :)