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

timer: Reduce size of Delay struct #554

Merged
merged 3 commits into from
Aug 22, 2018
Merged

timer: Reduce size of Delay struct #554

merged 3 commits into from
Aug 22, 2018

Conversation

carllerche
Copy link
Member

This tweaks the struct layout / details regarding how a Delay instance
is linked to a driver (timer instance). Instead of lazily allocating the
Entry (node shared between Delay and the timer), Entry is
allocated immediately when Delay is created. This allows using the
entry store data used by Delay.

This is in anticipation of further timer improvements that would
otherwise require the size of Delay to grow further. Since an
allocation is already made, the idea is to shrink the size of the
Delay struct.

It turns out that a better indicator of whether or not the number of
active timeouts should be decremented is if the `Entry` has been
associated with a timer. In other words, if `Entry::inner` can be
upgraded, then the count should be decremented on drop.
This tweaks the struct layout / details regarding how a `Delay` instance
is linked to a driver (timer instance). Instead of lazily allocating the
`Entry` (node shared between `Delay` and the timer), `Entry` is
allocated immediately when `Delay` is created. This allows using the
entry store data used by `Delay`.

This is in anticipation of further timer improvements that would
otherwise require the size of `Delay` to grow further. Since an
allocation is already made, the idea is to shrink the size of the
`Delay` struct.
@carllerche carllerche merged commit cf184eb into master Aug 22, 2018
@carllerche carllerche deleted the timer-internals branch August 22, 2018 04:52
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.

1 participant