From owner-freebsd-chat Tue Dec 17 01:21:36 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id BAA10518 for chat-outgoing; Tue, 17 Dec 1996 01:21:36 -0800 (PST) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id BAA10511 for ; Tue, 17 Dec 1996 01:21:30 -0800 (PST) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id KAA07955 for ; Tue, 17 Dec 1996 10:21:12 +0100 Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id KAA02629 for freebsd-chat@FreeBSD.ORG; Tue, 17 Dec 1996 10:21:11 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.8.4/8.6.9) id JAA14284 for freebsd-chat@FreeBSD.ORG; Tue, 17 Dec 1996 09:51:40 +0100 (MET) From: J Wunsch Message-Id: <199612170851.JAA14284@uriah.heep.sax.de> Subject: Re: snprintf vs. strncpy (was: Re: crontab security hole) To: freebsd-chat@FreeBSD.ORG Date: Tue, 17 Dec 1996 09:51:40 +0100 (MET) Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: from Marc Slemko at "Dec 16, 96 09:25:18 pm" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-chat@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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. ;-)