Conversation
Replace % with bitwise arithmetic. This helps reduce the performance regression seen between 1.03 and master.
This is a significant performance improvement.
ben-clayton
approved these changes
Feb 27, 2018
|
|
||
| #include <unordered_map> | ||
|
|
||
| static_assert((GAPIL_MIN_MAP_SIZE & (GAPIL_MIN_MAP_SIZE - 1)) == 0, "Map size must be a power of 2"); |
Contributor
There was a problem hiding this comment.
Might be worth putting a similar assert in the compiler.
gapii/cc/BUILD.bazel
Outdated
| "//core/memory_tracker/cc", | ||
| "//core/os/device/deviceinfo/cc", | ||
| "//gapil/runtime/cc", | ||
| "//gapil/runtime/cc:cc", |
Contributor
There was a problem hiding this comment.
Should be no need for the :cc
gapil/runtime/cc/BUILD.bazel
Outdated
| deps = [ | ||
| "//core/memory/arena/cc", | ||
| ":headers", | ||
| "//core/memory/arena/cc:cc", |
We require that they are a power of 2, otherwise we have to fall back to a slow % operator, instead of &.
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.
This fixes #1646.
The performance overhead of libgapii is now actually lower than it was in 1.03.