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
Multiple SortDescriptors sorting got slow with newer Realm versions #7092
Comments
@Fab1n Thanks for providing us with the above information and sample app. I've ran the two versions through time profiler and sent the findings onto the team. |
I can confirm there is some unexpected kind of interaction between the sorting and the encryption layer, not seen before Core6. |
Thanks @finnschiermer and @leemaguire for your help and confirmation. |
I will have a look at this. |
Was not able to spot the main cause for this degradation. But I can see that the new design takes a hit when encryption is on - this does not happen so much in the old design. |
I assume the performance improvement we have done provides remedy for the issue. Closing. |
Goals
Sorted
Results
usingSortDescriptors
like this should be as fast as in the past (like inv3.19.0
):Expected Results
Switching from Realm
3.19.0
to10.1.4
sorted results should be equally performant as with the version switched from.Actual Results
The performance of these sorted results dropped by a factor of 2 minimum.
Steps for others to Reproduce
Please follow the steps provided in the code sample repository.
But in a nutshell I will give you the TLDR; version here:
Having
String
(UUID) andBool
(allfalse
!) in this case - but could be others),1_000_000
in this case),SortDescriptors
, first by theBool
property, then by theString
propertyis giving you a 2x performance drop on
>= 10.1.4
compared to3.19.0
.(Sidenote: Removing the first sort descriptor makes the sorting faster from 3.19.0 to 10.1.4)
Here is most of the code from the sample project. It is meant for discussion here.
Please use the sample project together with Instruments (and signposts) to see the time spent executing the sorted query by yourself.
If have included a detailed test description as well as a detailed problem description in the README.md file there.
The model should look like this:
The requirements for the model properties are quite strechy, you basically could use any property types there, as long as it is given that one property's value largely is the same on all objects of the to-be-sorted
Results
.Connection to the database could look like this:
Generating data should look like this:
Executing the query should look like this:
Code Sample
https://github.com/Fab1n/realm-encrypted-sort-performance
Referenced Issues:
These issues are interesting for the topic of sorting, but may not directly be connected to this issue.
#6786
#4089
Version of Realm and Tooling
The text was updated successfully, but these errors were encountered: