Skip to content

Conversation

james7132
Copy link

@james7132 james7132 commented Aug 28, 2025

Partially fixes #78.

This attempts to minimize the amount of monomorphized codgen created while using this crate.

  • Header<M> has been split into Header and HeaderWithMetadata<M>, using repr(C) to keep pointers trivially castable between each.
  • Move any header-only operations onto the Header type.
  • Move out multiple entries of the TaskVtable to operate without every generic argument on RawTask, ,just the ones they need.
  • Make functions like get_output a function on the vtable itself instead of put in the vtable, both avoids an extra dynamic dispatch call, and shrinks the vtable.
  • Embed the RawWakerVtable in the TaskVtable and pass it into polymorphized functions.
  • Use #[inline(never)] on these polymorphized functions.

This PR also shifts to use byte_add, which does bump the MSRV to 1.75. If this is too much of a bump for such a gain, I can revert that.

Benchmarks:

master
test task_create ... bench:         131.02 ns/iter (+/- 98.60)
test task_run    ... bench:         149.03 ns/iter (+/- 106.22)

polymorphization
test task_create ... bench:         123.16 ns/iter (+/- 33.41)
test task_run    ... bench:         150.04 ns/iter (+/- 21.27)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated raw function monomorphizations
1 participant