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

Expose overloads of the set methods that operate on collections #4226

Closed
sync-by-unito bot opened this issue Dec 16, 2020 · 3 comments
Closed

Expose overloads of the set methods that operate on collections #4226

sync-by-unito bot opened this issue Dec 16, 2020 · 3 comments
Assignees

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented Dec 16, 2020

.NET and Java need to expose an API where we call a set-specific method on a set with a non-set argument, such as Results or List. So we should ensure that all methods outlined in #4225 can accept any of the collection types. They should special case the Set argument case to provide a more efficient implementation, but should also work (slower) on results and lists.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Jan 4, 2021

➤ Yavor Georgiev commented:

[~simon.ulsnes] is this possible to implement?

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Feb 18, 2021

➤ Simon Ulsnes commented:

It is possible to implement (anything is �), but what are the expectations? The standard library algorithms that we use assume that the input is already a sorted range of unique elements, and I guess we could not do that for List and Result.

There are also some design considerations with Object Store's Set, where the caller has to indicate the type of the input list, which is going to be awkward. Some thought is required there.

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Feb 23, 2021

➤ Nikola Irinchev commented:

The .NET implementation accepts any collection as an argument to Union/Difference/etc. We do a runtime cast to check if the argument is an in-memory collection or a Realm-backed collection (such as List/Results/Set).

  • If it's a .NET collection, we use a naive implementation that works with the in-memory collection, optimizing for access/modification of the in-memory collection rather than crossing the native-managed boundary.
  • If it's a Realm collection, we would like to call a OS API like Set::assign_union(RealmCollection& rhs) and have OS/Core work figure out what to do - ideally, using optimized implementation for the Set case and a naive, but not terrible implementation for the Results/List case.

The reason why #2 has to be implemented in native code is that the general-purpose implementation written in C# would be extremely slow due to the native-managed transitions. There will likely be a similar consideration for Java, which is why it'd be ideal to have these methods implemented in OS.

@sync-by-unito sync-by-unito bot closed this as completed Mar 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 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

No branches or pull requests

1 participant