Skip to content
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

Change timeout/delay functions to non-async #910

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

dalegaard
Copy link
Contributor

Hi,

Because of a compiler bug, the async implementations of delay/delay_until/timeout/timeout_at produce much larger RAM footprint than they should. This was documented in #890.

This patch replaces those implementations with structs with Future implementations instead. On my current project, over three tasks, this saves 488(776->288) bytes over three tasks that used the delay and timeout functionality. As the target has only 8k of RAM, this was a significant saving.

All tests pass, but if someone could take an extra look at the Delay implementation to verify that it is indeed safe, that would be great. I've not done much work with unsafe Rust so it's new territory for me.

Best regards,
Lasse

@dalegaard dalegaard force-pushed the improve_delay_memory branch from 96f99df to 99e69d1 Compare March 26, 2024 18:47
@Finomnis
Copy link
Contributor

Finomnis commented Apr 13, 2024

Might have to redo this one after #874 was merged ... :/ sorry for that.

@dalegaard dalegaard force-pushed the improve_delay_memory branch from 99e69d1 to 2a18277 Compare June 20, 2024 07:46
@dalegaard
Copy link
Contributor Author

Might have to redo this one after #874 was merged ... :/ sorry for that.

No worries, I've rebased on to latest master and updated.

Best regards,
Lasse

@korken89
Copy link
Collaborator

Hi @dalegaard, sorry you were hit by a short moment of broken CI! Could you rebase on master again? It should make CI pass for you so we can get this merged :)

@dalegaard dalegaard force-pushed the improve_delay_memory branch from 2a18277 to 38f519f Compare June 23, 2024 08:19
Because of a compiler bug, the `async` implementations of
`delay`/`delay_until`/`timeout`/`timeout_at` produce much larger RAM
footprint than they should.

Fixes rtic-rs#890.
@dalegaard
Copy link
Contributor Author

@korken89

Certainly, I've rebased it now.

Best regards,
Lasse

@korken89 korken89 added this pull request to the merge queue Aug 21, 2024
Merged via the queue into rtic-rs:master with commit a636f4e Aug 21, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants