Hello David Ribeiro Alves, Andrew Wong,

I'd like you to do a code review.  Please visit

    http://gerrit.cloudera.org:8080/6431

to review the following change.

Change subject: key_encoder: avoid unordered_map for looking up encoders
......................................................................

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
---
M src/kudu/common/key_encoder.cc
1 file changed, 15 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/31/6431/1
-- 
To view, visit http://gerrit.cloudera.org:8080/6431
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a9bf3a28e451562c3347fe9650db3874d62a368
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: David Ribeiro Alves <[email protected]>

Reply via email to