Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize combinators for resolved cases
This implements three optimizations, for three different combinators. For Future::all, if a future is already known to be failed, we know upfront that the result will be a failed future, and we can reuse this result. For Future::after, if a future is already resolved, there is no reason to keep it in the waiting list. For Future::first, if a future is already known to be resolved, we know upfront that the result will be a resolved future, and we can reuse this result. The implementations rely on `resolved?` and `failed?`, which according to the specs are not guaranteed to exist on a future, and thus the code has to check their presence before doing anything about it.
- Loading branch information