[Twisted-Python] How Twisted is This?
peter at engcorp.com
Wed Jul 16 16:53:05 EDT 2003
Bob Ippolito wrote:
> On Wednesday, Jul 16, 2003, at 12:12 America/New_York, Peter Hansen
> > One good reason to do the "every five minutes check" thing instead of
> > "wait exactly this long based on a precalculated value" thing is that
> > if the things to be monitored can be added or removed dynamically,
> > interrupting the sleep is more difficult than it's worth, while the
> > blind periodic check is much simpler and more robust.
> I don't necessarily agree with that. With the "every five minutes
> check" you have to write your own callLater mechanism, when you let
> tasks schedule themselves, you don't. Also with the "every five
> minutes check" you're using computer+bandwidth resources in a much less
> sane manner, it sure as hell isn't going to scale awfully well.
Mentioning callLater makes this an implementation question now, whereas
I believe both Brad and I were talking from a more general point of view.
I was, anyway. From a general point of view, I'm right ;-), because
you simply don't have to worry about issues related to adding or removing
items, or changing the time delays of them as you would if you calculated
the delay until the next activity and went to sleep for that long.
As for bandwidth: I'm of the "premature optimization is bad" school
of thought, and it's far too early in this discussion to be worrying
about a few microseconds of CPU usage per day...
More information about the Twisted-Python