This repository was archived by the owner on Aug 8, 2022. It is now read-only.
Add ParallelPixelProcessor using coroutines to multi-thread fuzzy bitmap comparisons#208
Merged
DanielJette merged 1 commit intomasterfrom Mar 23, 2021
Merged
Add ParallelPixelProcessor using coroutines to multi-thread fuzzy bitmap comparisons#208DanielJette merged 1 commit intomasterfrom
DanielJette merged 1 commit intomasterfrom
Conversation
b31ce3c to
b2d9c40
Compare
b2d9c40 to
e6eda6d
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What does this change accomplish?
Resolves #207
How have you achieved it?
The primary change in this PR is the introduction of the
ParallelPixelProcessorclass. The design of ParallelPixelProcessor is such that it creates a coroutine dispatcher pool matching the number of processor cores available. For example, on a 4-core device, a pool of 4 coroutines will be used. Then, the baseline image is chunked up into equal sized pieces, one for each core. Each chunk is then processed in parallel. In this manner, a significant speedup is achieved. Even for single-core processing, this algorithm is more computationally efficient in that it preloads the images into memory, rather that reading pixels via nested for-loops.Running on a 4-core emulator, yielded the following average improvements:
I have then refactored
FuzzyCompareto make use ofParallelPixelProcessor.Tophat instructions
The test
setExactnessinScreenshotRuleExampleTestscan demonstrate this change.FuzzyCompareBitmapTestalso can be used to test this.Notice
This change must keep
masterin a shippable state; it may be shipped without further notice.