Optimization: Use LIST_ instead of TAILQ_.#15
Optimization: Use LIST_ instead of TAILQ_.#15nmathewson wants to merge 2 commits intowahern:masterfrom
Conversation
According to the queue(3) manpage, TAILQ "operations run about 20% slower than lists". But this optimization comes at a nonzero cost. Notably: 1) When multiple items are added expiring all at the same time, they will no longer be triggered in exactly the same order in which they were added. 2) Potentially, we need to use more stack space in timeouts_update. (Make sure to benchmark this before merging; it may not actually be worthwhile.)
|
This will conflict with #14; I'm happy to help with the merge if you want to take both. |
|
Hm, we'd better be careful here. I just ran the benchmarks over master and all 3 of these branches, and to my surprise they don't show a very large improvement. (I wasn't very careful in my setup, though, so maybe better benchmark run would show results better.) |
|
At least the stack requirement is fixed at compile time, but it gives me pause because
|
According to the queue(3) manpage, TAILQ "operations run about 20%
slower than lists". So using LIST_ instead ought to make our code much faster.
But this optimization comes at a nonzero cost to other aspects of the code.
Notably:
When multiple items are added expiring all at the same time, they
will no longer be triggered in exactly the same order in which
they were added. (Since we have to add to lists at the head,
whereas we could add to tailqs at the tail.)
We need to use more stack space in timeouts_update, since we
can no longer concatenate many tailqs into one.
(Make sure to benchmark this before merging; it may not actually be
worthwhile. I have looked at the generated code, but not benchmarked it.
Also, I am not sure whether the issues I mention above make this patch a
bad idea or not.)