>
> That doesn't have to be the case.  Libuv would only use the timerfd 
> when sub-millisecond precision is needed, and only in one-shot mode. 
>

The thing now is that if I create a timer with 1ms precision it will get 
called
~930 times and not 1k(+-1) times. I think the nano second precision is 
needed
even if we only want precise millisecond precision. (look at the node 
script i provided
in the beginning of the discussion). The drift really flat lines only at 
5-6 ms (the
% off is then to small to calculate based on milli seconds)

I haven't run into an issue yet where I really need those 1k calls a second 
... but it
would nice to have?
 

> A potential drawback is that libuv, upon returning from epoll_wait(), 
> may have to scan the events list for the timerfd first.  If a number 
> of normal callbacks run first, a high-resolution timer isn't much 
> good.
>

We feed the timerfd as the first into the epoll_event array and then it
is immediately always the first one when we are checking for the events?
Doesn't save us from scanning the entire event list?

A satured event loop (more events then manageable in a small timerframe)
on the other hand is a problem (webservers under high load) but maybe 
sometimes
a user has not many events in the event loop and deliberately wants that
1000fps?
 

> In most cases when the timerfd expires, the list will only contain the 
> timerfd and nothing else, so it probably won't be too bad. 
>
> Perhaps it's an idea to batch events first instead of dispatching 
> callbacks straight from uv__io_poll().  That would allow for more 
> optimizations than just avoiding the scan; for example, it would make 
> it possible to coalesce a read and write event for the same file 
> descriptor into a single callback. 
>
>  

I can answer that question: because it was more work and < 1 ms 
> precision wasn't needed at the time. :-) 
>

Can you come up with some scenarios where such precision would be useful?

Would an actual implementation downgrade the performance? (since we need
to use nano second based timers and a while ago we a discussion about
Performance Counters)

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to