Todd Lipcon has submitted this change and it was merged. Change subject: Inlined dispatch for predicate evaluation ......................................................................
Inlined dispatch for predicate evaluation In order to evaluate a predicate, the correct comparator must first be determined. Batched evaluation, which calls ColumnPredicate::Evaluate(), will make a function call to the correct comparator for every row. The evaluation itself gets split into batches, but each row in the batch still makes the function call, which slows performance. To remediate this, this evaluation has been templatized so there is only a single function call per batch. Additionally, when decoder-level evaluation is enabled, rather than occuring in batches, dispatch occurs for each cell at EvaluateCell, which leads to poorer performance. To remediate this, the dispatch has been templatized in hopes that the dispatching and branching are inlined. This figure shows the performance of plain encoding for decoder-level evaluation without this templating adjustment. The query selects a one tenth the values out of a plain-encoded column containing 10M strings. EvaluateCell (the Pushdown bar) in this implementation gets compiled to a dispatched function call per row, which slows it down. Evaluate (the Normal Eval bar) also dispatches once per row. https://raw.githubusercontent.com/anjuwong/kudu/695cbaa016a8e94f164105d84024ceaac4b62375/docs/images/SELECT_WHERE_EQUAL_without_inlining.png Compare the above with the plot below, which is the result of the same query, but with inlined dispatch. The comparator is known statically, so calls to EvaluateCell will be inlined. Additionally, Evaluate only dispatches once per batch. https://raw.githubusercontent.com/anjuwong/kudu/695cbaa016a8e94f164105d84024ceaac4b62375/docs/images/SELECT_WHERE_EQUAL_with_inlining.png Change-Id: Iccfac9bc899362b442337050795b5ca8c4101268 Reviewed-on: http://gerrit.cloudera.org:8080/4164 Tested-by: Kudu Jenkins Reviewed-by: Todd Lipcon <[email protected]> --- M src/kudu/cfile/binary_plain_block.cc M src/kudu/cfile/cfile_reader.cc M src/kudu/common/column_predicate.cc M src/kudu/common/column_predicate.h 4 files changed, 57 insertions(+), 41 deletions(-) Approvals: Todd Lipcon: Looks good to me, approved Kudu Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/4164 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iccfac9bc899362b442337050795b5ca8c4101268 Gerrit-PatchSet: 11 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Andrew Wong <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Andrew Wong Gerrit-Reviewer: Dan Burkert <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Todd Lipcon <[email protected]>
