Processing Realm Objects in Parallel.ForEach #3491
dharamhbtik
started this conversation in
General
Replies: 1 comment
-
If you just want to go over the collection and not modify or listen for changes, you can freeze it before processing it in parallel. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have list of more than 1K items which is causing issue while loading in the Xamarin Forms list as we are doing some checks also. In order to Optimize this, we were trying to move the filtration and processing into separate method and use Parallel.ForEach so that processing can be faster. We are not modifying any property which requires transaction. Only accessing the RealmObject property
.
Something like this
Parallel.ForEach(Items,item=> item.PersonWeight>0);
So this is throwing exception as "Realm is accessed from incorrect thread";
I tried it to wrap into AsyncContext of Nito library but it is still throwing the exception.
Any suggestion how to tackle this?
Beta Was this translation helpful? Give feedback.
All reactions