-
Notifications
You must be signed in to change notification settings - Fork 33
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
Replace MaybeDone
/Fuse
with separate input/output/state fields
#22
Comments
MaybeDone
to sets of outputsMaybeDone
/Fuse
to sets of outputs
MaybeDone
/Fuse
to sets of outputsMaybeDone
/Fuse
with separate input/output/state fields
So @yoshuawuyts talked about this on mastodon, I proposed in response to associate index and relevant generic in the macros like so: macro_rules! associated {
(/* other elements */; $( ($Fi: literal, $Ft: ident) ),+; /* other elements */) => {
#[test]
fn test_indexes_are_sorted() {
let indexes = [$($Fi),+];
assert!(indexes.is_sorted(), "Indexes are not sorted in call to macro `associated!()`");
}
// With the test running in CI you can use the following to get the max index easily:
const LEN: usize = {
let indexes = [$($Fi),+];
let min = match indexes {
[min, ..] => min,
};
let max = match indexes {
[.., max] => max,
};
max - min + 1
} ;
};
} |
If you are having names conflicts for testing or such, what you can do is add a #[cfg(test)
mod $test_mod_name {
use super::*;
/* put tests here */
} |
#74 is probably the furthest along in setting up the machinery required for the tuples. It just needs one last change to ensure that tuple outputs are written in-place, rather than copied. |
It can probably be done without using "paste" but I'm being picky 😄 if I find the time to make a PR before the other is merged I'll make a comparison |
Right now we're using
MaybeDone
internally to track the state of each future. It can either be: "pending", "containing data", or "done". This is nice from an implementation perspective, but bad for performance. Namely:MaybeDone
structure. And once to copy the data to the output structure.The solution is to move the container of futures in-line. Create the container of outputs containing
MaybeUninit
. And finally create a separate container to track the state. Once all futures have completed, we can mark the output container as "initialized" and immediately yield that.Tasks
Priority
Join for Vec
RemoveMaybeDone
fromimpl Join for Vec
#29Join for Array
RemoveMaybeDone
fromimpl Join for array
#72Join for tuple
RemoveMaybeDone
fromtuple::join
#74Race for Vec
(not needed)Race for Array
(not needed)Race for tuple
(not needed)Secondary
Merge for Vec
inlinepoll_states
and removeFuse
forvec::merge
#79Merge for Array
RemoveFuse
fromimpl Merge for array
#70Merge for tuple
Eventually
TryJoin for Vec
TryJoin for Array
RaceOk for Vec
RaceOk for Array
The text was updated successfully, but these errors were encountered: