mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Improve performance of FunctionsLogical a little by adding "restrict"
This commit is contained in:
parent
abb9b25fa0
commit
2613012fd1
@ -299,28 +299,29 @@ struct OperationApplier
|
||||
static void apply(Columns & in, ResultData & result_data, bool use_result_data_as_input = false)
|
||||
{
|
||||
if (!use_result_data_as_input)
|
||||
doBatchedApply<false>(in, result_data);
|
||||
doBatchedApply<false>(in, result_data.data(), result_data.size());
|
||||
while (!in.empty())
|
||||
doBatchedApply<true>(in, result_data);
|
||||
doBatchedApply<true>(in, result_data.data(), result_data.size());
|
||||
}
|
||||
|
||||
template <bool CarryResult, typename Columns, typename ResultData>
|
||||
static void NO_INLINE doBatchedApply(Columns & in, ResultData & result_data)
|
||||
template <bool CarryResult, typename Columns, typename Result>
|
||||
static void NO_INLINE doBatchedApply(Columns & in, Result * __restrict result_data, size_t size)
|
||||
{
|
||||
if (N > in.size())
|
||||
{
|
||||
OperationApplier<Op, OperationApplierImpl, N - 1>
|
||||
::template doBatchedApply<CarryResult>(in, result_data);
|
||||
::template doBatchedApply<CarryResult>(in, result_data, size);
|
||||
return;
|
||||
}
|
||||
|
||||
const OperationApplierImpl<Op, N> operation_applier_impl(in);
|
||||
size_t i = 0;
|
||||
for (auto & res : result_data)
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
if constexpr (CarryResult)
|
||||
res = Op::apply(res, operation_applier_impl.apply(i++));
|
||||
result_data[i] = Op::apply(result_data[i], operation_applier_impl.apply(i));
|
||||
else
|
||||
res = operation_applier_impl.apply(i++);
|
||||
result_data[i] = operation_applier_impl.apply(i);
|
||||
}
|
||||
|
||||
in.erase(in.end() - N, in.end());
|
||||
}
|
||||
@ -331,7 +332,7 @@ template <
|
||||
struct OperationApplier<Op, OperationApplierImpl, 0>
|
||||
{
|
||||
template <bool, typename Columns, typename Result>
|
||||
static void NO_INLINE doBatchedApply(Columns &, Result &)
|
||||
static void NO_INLINE doBatchedApply(Columns &, Result &, size_t)
|
||||
{
|
||||
throw Exception(
|
||||
"OperationApplier<...>::apply(...): not enough arguments to run this method",
|
||||
|
Loading…
Reference in New Issue
Block a user