apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: proposed change to reduce nonblocking socket performance overhead
Date Tue, 11 Dec 2001 11:29:27 GMT
Brian Pane <bpane@pacbell.net> writes:

> The logic for setting the nonblocking state looks like
> this:
> 
>   - fcntl(sd, F_GETFL, ...) to get the current flags on
>     the socket descriptor
>   - OR the flags with O_NONBLOCK or O_NDELAY or O_FNDELAY,
>     depending on the OS.
>   - fcntl(sd, F_SETFL, flags) to set the new flags.
> 
> According to the profiler data, the F_GETFL fcntl operation
> is more expensive than the F_SETFL one.

Dumb question...  Have you tried commenting out the F_GETFL to see
what happens?  Does the F_SETFL suddenly get more expensive?

What I wonder about is if there is some stream operation that has to
be performed on one of these first socket calls such that if you
remove F_GETFL it just makes the next call more expensive.

(I have nothing against getting rid of F_GETFL in general; I just
wonder what is really going on.  It doesn't make much sense that
F_GETFL is more expensive than F_SETFL.  Only some side-effect not
strictly related to F_GETFL -- VM operation or stream operation or
other -- could explain it.)
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message