unix: hierarchical time wheels implemention and benchmarks#823
unix: hierarchical time wheels implemention and benchmarks#823yjhjstz wants to merge 3 commits intolibuv:v1.xfrom
Conversation
70ef369 to
455a43b
Compare
| This file is licensed to you under your choice of the GNU Lesser | ||
| General Public License, version 3 or any later version (LGPLv3 or | ||
| later), or the GNU General Public License, version 2 (GPLv2), in all | ||
| cases as published by the Free Software Foundation. |
There was a problem hiding this comment.
We cannot incorporate code with this license.
f6f07eb to
837e5cd
Compare
|
update benchmark result, big improve! |
| @@ -0,0 +1,241 @@ | |||
| #ifndef _LLIST_H | |||
There was a problem hiding this comment.
Is this the same file as before? If so, you can't just delete the license and be done with it, we cannot incorporate GPL code. Can't you use our queue.h?
There was a problem hiding this comment.
Later, I will try use queue.h , any other suggestion?
837e5cd to
ed3626f
Compare
|
update commit message, separate implemention and benchmarks. |
|
Sorry @yjhjstz, I won't be able to look at this in the upcoming weeks. I have not forgotten though! |
|
any other libuv member can review it for me ? thanks. |
| #endif | ||
|
|
||
|
|
||
| // 8+6+6+6+6=32 |
There was a problem hiding this comment.
do not use //, use only /* */, old c style compliant comments
|
Just putting out the inpact on the struct sizes. With your code: with the old code: |
| heap_remove((struct heap*) &handle->loop->timer_heap, | ||
| (struct heap_node*) &handle->heap_node, | ||
| timer_less_than); | ||
| --handle->loop->timer_counter; |
There was a problem hiding this comment.
I think handle->loop->timer_counter-- would be cleaner (put the decrement operator at the end).
2a6ca2b to
cb3e46c
Compare
|
ping me if I forget to take a look :) |
|
cc @libuv/collaborators |
|
Ping @Fishrock123? I don't have time to review it myself. |
|
@saghul can you ? |
|
@yjhjstz sorry, I don't have much time these days. At any rate, this PR would need to be applied to master, not v1.x because it breaks the ABI. And it should be used also on Windows. Give this is a v2 thing, it may take a while for us to find the time, please don't despair! |
|
ugh geez, I'll try to take a look soon >_< |
|
@saghul in http://www.slideshare.net/saghul/planning-libuv-v2/12?src=clipshare you noted that:
Could you give some more insight as to points 1 and 2 there? I am relatively familiar with the complexity increase. |
|
Also as a note from my time profiling Node timers: the existing impl here seems pretty performant. (And AFAIK the existing algorithm is a |
|
@Fishrock123 I was planning on commenting here, but ran out of time yesterday :-S @bnoordhuis can probably elaborate but the key points (if I noted them correctly) are:
For these reasons we ( @bnoordhuis, @piscisaureus, @indutny and myself ) generally agreed to not pursue this. If anyone sees any inaccuracies please feel free to correct me here. |
|
Thanks. I'll try to read though that wall of text within the next few days. |
|
Thanks! At any rate, we should consider including the benchmarks. |
|
So at least in regarding to how node does stuff, @apapirovski took a look at using timer wheels and we both concluded that it was a less optimal solution than the one we already have and is already described in this great big wall of text. That is: make a map of timer durations to linked lists, insert timers to the end of those lists, and keep timeout information on those lists similar to a heap, processing it first similar to a heap, and then the timers in each list. (That's the tl;dr, please go read the read deal for more.) Modern linux distro timer wheels have very slightly improved perf characteristics (always Edit: In case it wasn't clear, I personally recommend closing this. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
see issue #809.
time wheels worse case benchmark result:
heap:
time-wheels:
heap:
time-wheels:
@saghul @bnoordhuis