diff --git a/CHANGELOG.md b/CHANGELOG.md index 972dba40d11..93034b47524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### Enhancements * (PR [#????](https://github.com/realm/realm-core/pull/????)) -* None. +* Improve performance of equality queries on a non-indexed mixed property by about 30%. ([#6506](https://github.com/realm/realm-core/issues/6506)) ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) diff --git a/src/realm/array_mixed.cpp b/src/realm/array_mixed.cpp index 24d376eaf22..c9fb0ededd8 100644 --- a/src/realm/array_mixed.cpp +++ b/src/realm/array_mixed.cpp @@ -218,7 +218,7 @@ size_t ArrayMixed::find_first(Mixed value, size_t begin, size_t end) const noexc if (end == realm::npos) end = size(); for (size_t i = begin; i < end; i++) { - if (this->get_type(i) == type && get(i) == value) { + if (Mixed::data_types_are_comparable(this->get_type(i), type) && get(i) == value) { return i; } } diff --git a/src/realm/query_engine.cpp b/src/realm/query_engine.cpp index 93c63fbcfd8..910bf2706d8 100644 --- a/src/realm/query_engine.cpp +++ b/src/realm/query_engine.cpp @@ -189,12 +189,7 @@ size_t MixedNode::find_first_local(size_t start, size_t end) return m_index_evaluator->do_search_index(m_cluster, start, end); } else { - Equal cond; - for (size_t i = start; i < end; i++) { - QueryValue val(m_leaf_ptr->get(i)); - if (cond(val, m_value)) - return i; - } + return m_leaf_ptr->find_first(m_value, start, end); } return not_found;