Skip to content
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

Refactor parts of RLMQueryUtil to reduce template instantiations #7005

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Dec 16, 2020

The main change here is to transform queries which have a constant value on the LHS and a keypath on the RHS into one with the keypath on the RHS when possible. This eliminates a large number of redundant template instantiations, reducing the library size a bit and improving the build time. It also happens to make some queries which previous threw an exception work.

C++17 lets us replace some of the template metaprogramming with if constexpr making things a bit simpler.

Exception throwing has been shuffled around to reduce the size of the exception handler tables, and a few things have been refactored to cut down on unneeded duplication due to tmeplating.

In total this bumps about 100 kB off the macOS release binary and is a small net reduction in the amount of non-test code.

The main change here is to transform queries which have a constant value on the
LHS and a keypath on the RHS into one with the keypath on the RHS when
possible. This eliminates a large number of redundant template instantiations,
reducing the library size a bit and improving the build time. It also happens
to make some queries which previous threw an exception work.

C++17 lets us replace some of the template metaprogramming with `if constexpr`
making things a bit simpler.

Exception throwing has been shuffled around to reduce the size of the exception
handler tables, and a few things have been refactored to cut down on unneeded
duplication due to tmeplating.

In total this bumps about 100 kB off the macOS release binary and is a small
net reduction in the amount of non-test code.
@tgoyne tgoyne self-assigned this Dec 16, 2020
@tgoyne tgoyne requested a review from jsflax December 18, 2020 20:19
@tgoyne
Copy link
Member Author

tgoyne commented Dec 18, 2020

Test failures are unrelated; realm/realm-core#4234 fixed the one new one.

@tgoyne tgoyne merged commit fc50ee0 into master Jan 5, 2021
@tgoyne tgoyne deleted the tg/query-refactoring branch January 5, 2021 01:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants