[Twisted-Python] Re: r15451 - Fix test failures under windows by changing the eventual-send operation to

Paul G paul-lists at perforge.com
Sat Dec 31 15:38:48 EST 2005


----- Original Message ----- 
From: "Brian Warner" <warner at lothar.com>
To: "Twisted general discussion" <twisted-python at twistedmatrix.com>
Sent: Saturday, December 31, 2005 1:57 PM
Subject: [Twisted-Python] Re: r15451 - Fix test failures under windows by 
changing the eventual-send operation to


> To that end, using a separate queue for timers that are ready to go "now"
> (i.e. ones that will be fired before calling select() or the like) might 
> be
> useful, basically making N=0 a special case. This would avoid the overhead 
> of
> inserting the DelayedCall into an arbitrary place and maintaining the
> ordering guarantees of #2 and #3, and would avoid an extra select() spin
> between the time an N=0 timer was inserted and the time it was fired.

specialcasing this is ugly, imo, not that i get any votes ;) you need to 
decide:

1. what cost you want insert, traversal and possibly async sorting/ordering 
passes to carry
2. what guarantees you want to provide, in the general case

eg, it would be reasonable to say 'we want to be O(1) on traversal' (at 
least O(1) in terms of getting a list of events that fire now) and we want 
to guarantee ordering  in this case, you can decide to take the full 
ordering/sorting hit on inserts. if you think a little harder, this can be 
made fairly efficient with a sparse circular list of event buckets, with 
each bucket being a fifo queue of events to be fired at that time. whether 
it's worth bothering with the additional complexity is up for discussion.

i'm sleep deprived, so apologies in advance if this made no sense at all.

-p 





More information about the Twisted-Python mailing list