Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 1996 09:51:40 +0100 (MET)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-chat@FreeBSD.ORG
Subject:   Re: snprintf vs. strncpy (was: Re: crontab security hole)
Message-ID:  <199612170851.JAA14284@uriah.heep.sax.de>
In-Reply-To: <Pine.BSF.3.95.961216210309.10949D-100000@alive.ampr.ab.ca> from Marc Slemko at "Dec 16, 96 09:25:18 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
As Marc Slemko wrote:

> I think this discussion is far too sane.  Let's see who can make up the
> most meaningless numbers.

> marcs@alive:/tmp/str$ time ./snprintf ; time ./strncpy ; time ./strncpy-2
>         6.86 real         5.65 user         0.02 sys
>        11.50 real         9.85 user         0.00 sys
>         9.54 real         9.15 user         0.01 sys
> marcs@alive:/tmp/str$ 

funny. :)

> Hmm.  Seems like snprintf is nearly twice as fast in this case.
> What was that about considering your options?  Considering that we
> already have sprintf in Vixie's code...

Yep, that's about my thought as well...  and, it's often pointless to
over-optimize e.g. one-time initializations if the real waste of time
happens somewhere in an inner loop that's called a thousand times
anyway.  (I haven't checked crontab, and i don't claim this were the
case there.)

Btw., the ``bloat!'' argument is a moot point for shared linked
programs anyway.  stdio is always present then in its shared
incarnation, and due to so many programs using it so heavily, there's
a high probability that the related pages from the shared lib are
semi-resident in memory.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612170851.JAA14284>