Skip to content

ts: better use of `imp` & `elem` args in `Pad{Sink,Src}Handler`s

This is a follow-up to commit 7ee4afac.

This commit cleans up the Pad{Sink,Src}Handler by

  • Keeping arguments which are strictly necessary.
  • Passing arguments by value for the trait functions which return a Future. The arguments which were previously passed by reference were cloned internally and then cloned again in most implementations.

There are unfortunate differences in trait function signatures between those which return a Future and the sync functions. This is due to the requirement for the arguments to be moved to the resulting Future, whereas sync functions can rely on references. One particular notable difference is the use of the imp in sync functions instead of the elem in functions returning a Future. Because the imps are not guaranteed to implement Clone (and usually don't), we can't move it to the resulting Future, so the elem is used.

ts-standalone shows a slight improvement, but I'd like to enhance this bench tool with another element which would reduce the overhead due to the channel in current sink element. This new version should improve the ability to evaluate the impact of the sole framework. With this new element, we should get a better idea whether inlining the imp() or instance() function yields a significant advantage.

Edited by François Laignel

Merge request reports