CLICKHOUSE-3800: Add perf test

This commit is contained in:
alesapin 2018-08-29 20:49:43 +03:00
parent 7498105b67
commit d2a5efb11b
3 changed files with 78 additions and 3 deletions

View File

@ -90,6 +90,7 @@
M(CompileSuccess) \
\
M(CompileFunction) \
M(CompiledFunctionExecute) \
\
M(ExternalSortWritePart) \
M(ExternalSortMerge) \

View File

@ -50,6 +50,7 @@
namespace ProfileEvents
{
extern const Event CompileFunction;
extern const Event CompiledFunctionExecute;
}
namespace DB
@ -636,9 +637,21 @@ void compileFunctions(ExpressionActions::Actions & actions, const Names & output
/// the result of compiling one function in isolation is pretty much the same as its `execute` method.
if (fused[i].size() == 1)
continue;
auto fn = compilation_cache.getOrSet(fused[i], [&]() { return std::make_shared<LLVMFunction>(fused[i], context, sample_block); });
actions[i].function = fn.first;
actions[i].argument_names = fn.first->getArgumentNames();
std::shared_ptr<LLVMFunction> fn;
if (settings.compiled_expressions_cache_size > 0)
{
auto set_func = [&, context] () { return std::make_shared<LLVMFunction>(fused[i], context, sample_block); };
std::tie(fn, std::ignore) = compilation_cache.getOrSet(fused[i], set_func);
}
else
{
fn = std::make_shared<LLVMFunction>(fused[i], context, sample_block);
}
actions[i].function = fn;
actions[i].argument_names = fn->getArgumentNames();
ProfileEvents::increment(ProfileEvents::CompiledFunctionExecute); // because we always completely inline function
continue;
}

View File

@ -0,0 +1,61 @@
<test>
<name>small_requests</name>
<type>loop</type>
<stop_conditions>
<all_of>
<iterations>5</iterations>
<min_time_not_changing_for_ms>10000</min_time_not_changing_for_ms>
</all_of>
<any_of>
<iterations>5000</iterations>
<total_time_ms>60000</total_time_ms>
</any_of>
</stop_conditions>
<main_metric>
<bytes_per_second/>
</main_metric>
<metrics>
<rows_per_second/>
</metrics>
<query>
WITH
bitXor(number, 0x4CF2D2BAAE6DA887) AS x0,
bitXor(x0, bitShiftRight(x0, 33)) AS x1,
x1 * 0xff51afd7ed558ccd AS x2,
bitXor(x2, bitShiftRight(x2, 33)) AS x3,
x3 * 0xc4ceb9fe1a85ec53 AS x4,
bitXor(x4, bitShiftRight(x4, 33)) AS x5
SELECT x5, intHash64(number) FROM system.numbers LIMIT 10
</query>
<query>
WITH
bitXor(number, 0x4CF2D2BAAE6DA887) AS x0,
bitXor(x0, bitShiftRight(x0, 33)) AS x1,
x1 * 0xff51afd7ed558ccd AS x2,
bitXor(x2, bitShiftRight(x2, 33)) AS x3,
x3 * 0xc4ceb9fe1a85ec53 AS x4,
bitXor(x4, bitShiftRight(x4, 33)) AS x5
SELECT x5, intHash64(number) FROM system.numbers LIMIT 10
SETTINGS
compile = 1,
compile_expressions = 1,
compiled_expressions_cache_size = 0
</query>
<query>
WITH
bitXor(number, 0x4CF2D2BAAE6DA887) AS x0,
bitXor(x0, bitShiftRight(x0, 33)) AS x1,
x1 * 0xff51afd7ed558ccd AS x2,
bitXor(x2, bitShiftRight(x2, 33)) AS x3,
x3 * 0xc4ceb9fe1a85ec53 AS x4,
bitXor(x4, bitShiftRight(x4, 33)) AS x5
SELECT x5, intHash64(number) FROM system.numbers LIMIT 10
SETTINGS
compile = 1,
compile_expressions = 1
</query>
</test>