Reduced unnecessary high swap number#61
Open
SheikhWalter wants to merge 1 commit intoSpu7Nix:mainfrom
Open
Conversation
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.
I was looking in this project trying to understand how the code works for a personal project, and in my version I needed every single slight optimization I could do -It's a computer vision project-.
So I started tweaking with the parameters, and then I saw
const SWAPS_PER_GENERATION_PER_PIXEL: usize = 128;.I tried lowering it thinking it would improve the algorithm more with the tradeoff of the accuracy, but I was half correct..
Yes the performance was improved, but here's the thing.. the accuracy barely changed!
Then I added a widget to display the processing time to test even further.
And here are my test results:
const SWAPS_PER_GENERATION_PER_PIXEL: usize = 8;assignmentsvector updates each iteration -necessary for dynamic image display-If you want to see comparisons proving my point, here you go:
SWAPS_PER_GENERATION_PER_PIXEL = 128(Resolution = 128) Took 4.671sSWAPS_PER_GENERATION_PER_PIXEL = 8(Resolution = 128) Took 1.972sSWAPS_PER_GENERATION_PER_PIXEL = 4(Resolution = 128) Took 2.164sSWAPS_PER_GENERATION_PER_PIXEL = 2(Resolution = 128) Took 2.737sI made the same test with Resolution = 256, you can look at it in the Tests folder