improve performance by reusing the waker#30
Conversation
|
Nice catch. I can see how this should be faster in theory. In practice, I can't actually see any discernable difference beyond noise when benchmarking, although I suspect that's just because the benchmarks are too narrow to be useful. How have you been benchmarking this change, out of interest? Regardless, I'll merge it given that I see no discernable disadvantage to this change. |
|
Hey, Thanks mate, I maintain another library called |
|
That makes sense, thanks for clarifying. Out of interest, have you seen my experiments on this branch? |
|
Cool idea! I have seen it in https://github.com/DoumanAsh/thread-waker/blob/master/src/lib.rs , but it does not match the general performance of pollster or swait because of thread_local variable optimization. If you combine it with this method, I think it improves initialization process of the library. not sure about the performance impact, but could help the performance further through pointer indirection elimination. |
Hi,
This PR improves performance by avoiding Waker creation from the Signal on each call.
It greatly improves performance according to my benchmarks.
Hopefully it will get merged in the next two years (joking 😂).