Re: [Libevent-users] [PATCH] Do not call gettime in timeout_process if the timetree is empty

2007-09-20 Thread Christopher Layne
On Thu, Sep 20, 2007 at 01:52:31PM +0200, Trond Norbye wrote:
 The result of gettime is not used if the timetree is empty (and might 
 cause a context switch to get the system clock).
 
 --Trond

 Index: event.c
 ===
 --- event.c   (revision 440)
 +++ event.c   (working copy)
 @@ -804,24 +804,26 @@
  void
  timeout_process(struct event_base *base)
  {
 - struct timeval now;
 - struct event *ev, *next;
 + if (!RB_EMPTY(base-timetree)) { 
 + struct timeval now;
 + struct event *ev, *next;

Why not just return if RB_EMPTY() is true rather than adding another level
of indention? Other than that, I also noticed this but didn't consider it as
anything significant. It has never once showed up as any significant source
of cycles in profiling either.

-cl
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


Re: [Libevent-users] [PATCH] Do not call gettime in timeout_process if the timetree is empty

2007-09-20 Thread Nick Mathewson
On Thu, Sep 20, 2007 at 03:14:51PM +0200, Trond Norbye wrote:
 [...]
 
 Why not just return if RB_EMPTY() is true rather than adding another level
 of indention? 
 Some people (I'm not one of them) dislikes multiple return statements 
 from a function, so I just added the extra level to avoid annoying them ;-)

I'm not one of those people, so I'm rewriting your patch to a simple
if (RB_EMPTY(base-timetree)) return; and checking it in. ;)

yrs,
-- 
Nick Mathewson


pgpweF3qLpscB.pgp
Description: PGP signature
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users