forked from apache/kudu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
key_encoder: avoid unordered_map for looking up encoders
I saw EncoderResolver::GetKeyEncoder() taking up ~3% of CPU in some workloads, mostly caused by a 'div' instruction in unordered_map. Since we know that the type enums are low integers, we can just use a vector for lookup as well. This also switches from shared_ptr to unique_ptr for holding the resolvers: the shared_ptr is a holdover from pre-C++11 where putting single-ownership smart pointers into a container was impossible. Change-Id: I5a9bf3a28e451562c3347fe9650db3874d62a368 Reviewed-on: http://gerrit.cloudera.org:8080/6431 Reviewed-by: David Ribeiro Alves <[email protected]> Tested-by: Kudu Jenkins Reviewed-by: Andrew Wong <[email protected]>
- Loading branch information
1 parent
4f51c66
commit 3679ead
Showing
2 changed files
with
17 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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