> Worse, the concept of savestr() looks broken. The code comment says it is
> there to "reduce malloc() overhead incurred by strdup()". That's a
> horrendous case of a programmer inventing a problem. savestr() is only
> used a few times.

It's used on all name lookups, when building the address-to-name table;
it's probably not commonly used, as subsequent lookups of the same
address will find the entry that the call that used "savestr()" made.

> As if a few malloc() calls make a discernible difference in a program like
> traceroute!!

The program under discussion is tcpdump, not traceroute, so it might use
it more often.

> If only programmers would base their code on real-world measurements
> rather than guessing.... :-)

I'll try running versions with "savestr()" and "strdup()" on some large
capture files I have, so that we can, at least for those files, stop
guessing (whether the guess is that calls are common and it makes a
difference or that calls are rare and it doesn't make a difference).
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe

Reply via email to