[
https://issues.apache.org/jira/browse/IMPALA-11943?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Quanlong Huang resolved IMPALA-11943.
-------------------------------------
Fix Version/s: Impala 4.5.0
Resolution: Fixed
Resolving this. Thank [~daniel.becker] and [~csringhofer] for the review!
> Performance regression in utf8 string functions due to utf8_mode checks
> -----------------------------------------------------------------------
>
> Key: IMPALA-11943
> URL: https://issues.apache.org/jira/browse/IMPALA-11943
> Project: IMPALA
> Issue Type: Bug
> Components: Backend
> Affects Versions: Impala 4.1.0, Impala 4.2.0, Impala 4.1.1, Impala 4.1.2,
> Impala 4.3.0, Impala 4.4.0, Impala 4.4.1
> Reporter: Quanlong Huang
> Assignee: Quanlong Huang
> Priority: Critical
> Fix For: Impala 4.5.0
>
> Attachments: instr-perf.hist.txt, mask-perf.hist.txt
>
>
> IMPALA-2019 adds the UTF-8 aware behavior for string functions. The behavior
> is turned on by a query option, UTF8_MODE.
> String functions that have both UTF-8 and the traditional ASCII behaviors are
> added the checks for the UTF8_MODE query option. The check is intended to be
> replaced with constants during codegen in LlvmCodeGen::InlineConstFnAttrs().
> However, LlvmCodeGen::InlineConstFnAttrs() only replaces call instructions
> inside the current function. To replace the call to
> FunctionContextImpl::GetConstFnAttr() inside the callee functions, we have to
> inline the callee functions (by annotating them with IR_ALWAYS_INLINE).
> The UTF-8 related string functions are not annotated with IR_ALWAYS_INLINE,
> which cause performance regression when they are used in predicates, i.e.
> they are called in the predicate expressions.
> A perf-top measure shows that some portion of the cpu time is spent in
> GetConstFnAttr():
> {noformat}
> Overhead Shared Object Symbol
> 34.92% impalad [.] snappy::RawUncompress
> 7.05% perf-24093.map [.]
> impala::Operators::Gt_IntVal_IntValWrapper:c2426f4b421512bc:5a20733f00000000
> 7.02% perf-24100.map [.]
> impala::Operators::Gt_IntVal_IntValWrapper:c2426f4b421512bc:5a20733f00000000
> 7.00% perf-24096.map [.]
> impala::Operators::Gt_IntVal_IntValWrapper:c2426f4b421512bc:5a20733f00000000
> 6.26% [kernel] [k] native_flush_tlb_one_user
> 3.79% impalad [.]
> impala::FunctionContextImpl::GetConstFnAttr
> 3.44% impalad [.]
> impala::FunctionContextImpl::GetConstFnAttr
> 3.02% impalad [.]
> impala::ScalarColumnReader<impala::StringValue, (parquet::Type::type)6,
> true>::ReadSlotsNoConversion
> 1.74% [kernel] [k] smp_call_function_many
> 1.59% [kernel] [k] copy_user_enhanced_fast_string
> 1.34% impalad [.]
> impala::RuntimeState::query_options
> 1.21% impalad [.]
> impala::RuntimeState::query_ctx {noformat}
> Attached the perf histograms. [^instr-perf.hist.txt] is measured for query
> {code:sql}
> select count(*) from tpch100_parquet.lineitem
> where instr(l_comment, 'egular courts above the') > 0;{code}
> [^mask-perf.hist.txt] is measured for query
> {code:sql}
> select count(*) from tpch100_parquet.lineitem
> where mask(l_comment) is null;{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)