-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove unnecessary callback use for ArrayWithFind::find_action() #7095
Conversation
Pull Request Test Coverage Report for Build james.stone_406
💛 - Coveralls |
I did something similar in 9a33838. I think your approach is better, but |
af5bc36
to
badac29
Compare
Thanks for that feedback Thomas, I've removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a clang-format run and two trivial notes but otherwise looks good.
src/realm/query_conditions_tpl.hpp
Outdated
value = m_source_column->get_any(index); | ||
} | ||
else { | ||
static_cast<void>(m_source_column); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be any reason to need this. If it was an if constexpr
guarding the use of m_source_column you might get some spurious warnings but here the member variable is always used.
src/realm/array_with_find.hpp
Outdated
|
||
cond: One of Equal, NotEqual, Greater, etc. classes | ||
Action: One of act_ReturnFirst, act_FindAll, act_Max, act_CallbackIdx, etc, constants | ||
Callback: Optional function to call for each search result. Will be called if action == act_CallbackIdx | ||
Action: One of act_ReturnFirst, act_FindAll, act_Max, etc, constants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Action template parameter hasn't existed for a while.
CI failures appear unrelated. |
The query system supported two ways of dealing with matches: using QueryStateBase::match() and using a custom callback.
The callback was only used in one place, and I replaced it by caching the results array leaf inside our existing QueryStateBase handler class.
There is no noticeable performance drop for the affected query case that was using the callback. Here's the newly added benchmark compared to master showing no significant change for this case:
The benefit of doing this is that we can delay fetching the values until the
match()
function which may not even need the values at all, such as when counting the results. This should have some minimal performance improvement when counting results with many matches.In addition to the code clean up, this also removes a layer of templating throughout the query system which appears to remove about 100K of binary size off our static library (YMMV).
☑️ ToDos