mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Optimize Volnitsky by inlining compare function
This commit is contained in:
parent
957d23267b
commit
18d3813ff9
@ -156,7 +156,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool compare(const UInt8 * pos) const
|
ALWAYS_INLINE bool compare(const UInt8 * pos) const
|
||||||
{
|
{
|
||||||
static const Poco::UTF8Encoding utf8;
|
static const Poco::UTF8Encoding utf8;
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool compare(const UInt8 * pos) const
|
ALWAYS_INLINE bool compare(const UInt8 * pos) const
|
||||||
{
|
{
|
||||||
#ifdef __SSE4_1__
|
#ifdef __SSE4_1__
|
||||||
if (pageSafe(pos))
|
if (pageSafe(pos))
|
||||||
@ -568,7 +568,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool compare(const UInt8 * pos) const
|
ALWAYS_INLINE bool compare(const UInt8 * pos) const
|
||||||
{
|
{
|
||||||
#ifdef __SSE4_1__
|
#ifdef __SSE4_1__
|
||||||
if (pageSafe(pos))
|
if (pageSafe(pos))
|
||||||
|
@ -173,10 +173,7 @@ struct PositionImpl
|
|||||||
|
|
||||||
/// We check that the entry does not pass through the boundaries of strings.
|
/// We check that the entry does not pass through the boundaries of strings.
|
||||||
if (pos + needle.size() < begin + offsets[i])
|
if (pos + needle.size() < begin + offsets[i])
|
||||||
{
|
res[i] = 1 + Impl::countChars(reinterpret_cast<const char *>(begin + offsets[i - 1]), reinterpret_cast<const char *>(pos));
|
||||||
size_t prev_offset = i != 0 ? offsets[i - 1] : 0;
|
|
||||||
res[i] = 1 + Impl::countChars(reinterpret_cast<const char *>(begin + prev_offset), reinterpret_cast<const char *>(pos));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
res[i] = 0;
|
res[i] = 0;
|
||||||
|
|
||||||
@ -306,7 +303,8 @@ struct MultiSearchAllPositionsImpl
|
|||||||
const std::vector<StringRef> & needles,
|
const std::vector<StringRef> & needles,
|
||||||
PaddedPODArray<UInt64> & res)
|
PaddedPODArray<UInt64> & res)
|
||||||
{
|
{
|
||||||
auto res_callback = [](const UInt8 * start, const UInt8 * end) -> UInt64 {
|
auto res_callback = [](const UInt8 * start, const UInt8 * end) -> UInt64
|
||||||
|
{
|
||||||
return 1 + Impl::countChars(reinterpret_cast<const char *>(start), reinterpret_cast<const char *>(end));
|
return 1 + Impl::countChars(reinterpret_cast<const char *>(start), reinterpret_cast<const char *>(end));
|
||||||
};
|
};
|
||||||
Impl::createMultiSearcherInBigHaystack(needles).searchAllPositions(haystack_data, haystack_offsets, res_callback, res);
|
Impl::createMultiSearcherInBigHaystack(needles).searchAllPositions(haystack_data, haystack_offsets, res_callback, res);
|
||||||
@ -341,7 +339,8 @@ struct MultiSearchFirstPositionImpl
|
|||||||
const std::vector<StringRef> & needles,
|
const std::vector<StringRef> & needles,
|
||||||
PaddedPODArray<UInt64> & res)
|
PaddedPODArray<UInt64> & res)
|
||||||
{
|
{
|
||||||
auto res_callback = [](const UInt8 * start, const UInt8 * end) -> UInt64 {
|
auto res_callback = [](const UInt8 * start, const UInt8 * end) -> UInt64
|
||||||
|
{
|
||||||
return 1 + Impl::countChars(reinterpret_cast<const char *>(start), reinterpret_cast<const char *>(end));
|
return 1 + Impl::countChars(reinterpret_cast<const char *>(start), reinterpret_cast<const char *>(end));
|
||||||
};
|
};
|
||||||
Impl::createMultiSearcherInBigHaystack(needles).searchFirstPosition(haystack_data, haystack_offsets, res_callback, res);
|
Impl::createMultiSearcherInBigHaystack(needles).searchFirstPosition(haystack_data, haystack_offsets, res_callback, res);
|
||||||
|
Loading…
Reference in New Issue
Block a user