fix to util_sock.c

Christopher R. Hertel crh at
Sun Nov 12 19:56:32 GMT 2000

> However, for performance fixes, rather than internal code
> cleanup, I'd much prefer people to do actual profiling and
> report "with this patch I see XX% speedup on these actions",
> rather than guessing what will improve things. I've done that
> myself in the past, and my guesses like that have usually
> been wrong :-) :-). With the actual report we will have at
> least an idea of what to expect the changes rather than a
> theoretical speedup.


First, I understand and agree with our points about read() vs. recv(). 
There is a lot of experience on the Team that defies textbook "good
practice".  I learned this the hard way myself.  Samba, by its very
nature, is an adaptation to the harsh realities of the world.

Your approach to performance fixes, however, belies a certain
benchmark-oriented point of view.  The kind of streamlining you describe
is *very important*, but it isn't the only way to improve the code.  For
example, I got good feedback from you, and others, on the work I've done
simply rationalizing some of the modules.  Our code, in some places, is
dense and messy.  It doesn't get fixed because a) it works, and b) it is
not on any critical path.  That doesn't mean that it's the 'right'.

In addition to optimising critical code-path, I think it does make sense
to rationalize the code.  We do this by making it simpler and more
readable, by ensuring that we're not doing the same thing a half-dozen
different ways, and by organizing the code into logical groupings.  We can
also apply the principle of least surprise to the code.  We should be able
to reduce the number of instances in which a reader will say "why the heck
did they do it that way!?!?!"  (In some cases, this may simply mean adding
some comments.)

Anyway, this is a philosophical discussion rather than a discussion of 
the specific proposed changes.

Chris -)-----

Christopher R. Hertel -)-----                   University of Minnesota
crh at              Networking and Telecommunications Services

    Ideals are like stars; you will not succeed in touching them
    with your choose them as your guides, and following
    them you will reach your destiny.  --Carl Schultz

More information about the samba-technical mailing list