Smithay / calloop

A callback-based Event Loop
MIT License
176 stars 34 forks source link

Replace futures-util with async-task #124

Closed notgull closed 1 year ago

notgull commented 1 year ago

Right now, calloop uses futures-util's FuturesUnordered type to construct its executor. However, futures-util has quite a few dependencies. This PR migrates to another implementation based on the async-task crate, which is dependency free and builds faster. The implementation also uses fewer synchronization primitives, so it should be faster in theory.

I also add slab as a dependency, but since #123 also adds it we should be alright here.

WIP for now

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 95.94% and project coverage change: +0.63 :tada:

Comparison is base (725e16a) 88.23% compared to head (d9f48fa) 88.87%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #124 +/- ## ========================================== + Coverage 88.23% 88.87% +0.63% ========================================== Files 15 15 Lines 1556 1672 +116 ========================================== + Hits 1373 1486 +113 - Misses 183 186 +3 ``` | Flag | Coverage Δ | | |---|---|---| | macos-latest | `88.58% <95.94%> (+0.73%)` | :arrow_up: | | ubuntu-latest | `88.40% <95.94%> (+0.70%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/Smithay/calloop/pull/124?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay) | Coverage Δ | | |---|---|---| | [src/sources/futures.rs](https://codecov.io/gh/Smithay/calloop/pull/124?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay#diff-c3JjL3NvdXJjZXMvZnV0dXJlcy5ycw==) | `93.85% <95.94%> (+6.55%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Smithay)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

elinorbgr commented 1 year ago

Looks like your PR changed some behavior, as a test is no longer passing, and it does not look like a fluke.

notgull commented 1 year ago

Looks like your PR changed some behavior, as a test is no longer passing, and it does not look like a fluke.

Yeah, I misread how the channels work and made it so it only drained 1 Runnable instead of a chunk of Runnables, which messed up the dispatching tests. This should be fixed now.