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

Box TokioTasksRuntime for efficient moves into and out of world during tick_runtime_update #7

Merged
merged 1 commit into from
Feb 19, 2023

Conversation

JoeHowarth
Copy link
Contributor

@JoeHowarth JoeHowarth commented Feb 16, 2023

@EkardNT
Copy link
Owner

EkardNT commented Feb 18, 2023

The current TokioTasksRuntime struct is 120 bytes on my 64-bit machine, which does seem to be worth the tradeoff of one additional indirection when accessing the proposed new inner field.

But, from an encapsulation point of view, I would prefer not to expose this internal optimization to users of the crate. So I suggest making the TokioTasksRuntimeInner struct not pub, which will also require removing the pub on the TokioTaskRuntime tuple struct entry and the runtime field inside the TokioTasksRuntimeInner. Then replace the ability to directly access the pub runtime field with a public runtime() method on TokioTasksRuntime which returns a reference to the Runtime. This will also require updating the methods already on TokioTasksRuntime to have a bunch of self.0 references, of course.

@EkardNT
Copy link
Owner

EkardNT commented Feb 19, 2023

I am going to merge this to get the basic change in and then tweak a few details as described above.

@EkardNT EkardNT merged commit 101dd5d into EkardNT:master Feb 19, 2023
@EkardNT
Copy link
Owner

EkardNT commented Feb 19, 2023

This improvement is now available in 0.9.5.

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.

None yet

2 participants