This repository was archived by the owner on Feb 18, 2024. It is now read-only.
Optimize comparison kernels#17
Merged
jorgecarleitao merged 3 commits intojorgecarleitao:mainfrom Mar 21, 2021
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #17 +/- ##
==========================================
- Coverage 63.31% 63.31% -0.01%
==========================================
Files 150 150
Lines 14424 14422 -2
==========================================
- Hits 9133 9131 -2
Misses 5291 5291
Continue to review full report at Codecov.
|
Collaborator
Author
|
There is also a strange part in the benchmark here. As the left & right arrays are using the same seed, they have exactly the same elements! |
Owner
|
Thanks @Dandandan . It was a lot of fun to go through this with you. :) |
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.
This avoids the conditional jumps, which is faster when the pattern is not super predictable (which is the case for
%10).I also "fixed" the benchmarks, as they currently run on two arrays with equal elements as they use the same seed and introduced a
ltversion.For arrays with a high "matching percentage" this has a huge performance impact (see lt benchmark, this is 5-10x faster), but a low matching percentage (eq on random floats) it is slower to compare two arrays. The
eqbenchmark will now match probably never, so the CPU can predict those branches perfectly in the version onmain.