-
Notifications
You must be signed in to change notification settings - Fork 70
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
Revert "Optimize poll loop slightly" #225
Revert "Optimize poll loop slightly" #225
Conversation
This reverts commit ad76225.
Good catch! I didn't think about new futures being added while polling, however, won't the reverted code have the same problem as the current? I believe the iterator returned by The ultimate problem is that we have aliasing mutable references which will always be unsound. I think the only proper solution is to implement the schedular with a linked list. |
Nope, because we are not mutating the array from inside the iterator. We are simply collecting indexes.
A double linked list might be an alternative but i suspect pointer following might have slight performance implications for lots of spawns. |
I disagree, the for loop holds onto a iterator to the futures vector which is just a pointer to the memory of the vector. Then inside the for loop We could possibly change to using indexes in the array, but I believe, because we are supposed to have exclusive access to the futures vec the compiler could decide to still optimize the array index away to again using pointers.
If it is done right the schedular wouldn't even have to follow pointers that often. I have been thinking about implementing the schedular with two linked lists such that whenever a future calls |
You are absolutely right, my bad. I think using two linked lists is a fantastic idea 👌 |
Closing in favor of #228 |
This reverts commit ad76225.
Fixes #224