From owner-freebsd-current@FreeBSD.ORG Tue Nov 18 12:46:39 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D555316A4CE for ; Tue, 18 Nov 2003 12:46:39 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id A9C1243F85 for ; Tue, 18 Nov 2003 12:46:38 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id hAIKkT50091354; Tue, 18 Nov 2003 14:46:29 -0600 (CST) (envelope-from dan) Date: Tue, 18 Nov 2003 14:46:29 -0600 From: Dan Nelson To: "M. Warner Losh" Message-ID: <20031118204629.GC79003@dan.emsphone.com> References: <200311181307.hAID7uHa032514@dyson.jdyson.com> <20031118.092100.108186967.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline In-Reply-To: <20031118.092100.108186967.imp@bsdimp.com> X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.5.1i cc: dyson@iquest.net cc: current@freebsd.org Subject: Re: Unfortunate dynamic linking for everything X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2003 20:46:40 -0000 --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In the last episode (Nov 18), M. Warner Losh said: > In message: <200311181307.hAID7uHa032514@dyson.jdyson.com> > dyson@iquest.net writes: > : It really doesn't make sense to arbitrarily cut-off a discussion > : especially when a decision might be incorrect. > > I'd say that good technical discussion about why this is wrong would > be good. However, emotional ones should be left behind. Except for > John's message, most of the earlier messages have been more emotional > than technical. > > John, do you have any good set of benchmarks that people can run to > illustrate your point? Pretty much any benchmark that you can build statically and dynamically should suffice. I've attached a simple one that fills an array with random numbers then qsorts them. "make compare" will generate three graphs at the end: time spent loading the executable, time spent within the loops, and total time. Note that both load and loop timings are higher for the dynamic binary. I ran it on a busy system, which is why there are so many outliers. Make sure you have src/tools/tools/ministat installed someplace in your path. Also see http://lists.freebsd.org/pipermail/freebsd-current/2003-April/001106.html , where I had posted proc/pid/maps for a static and dynamic ls. -- Dan Nelson dnelson@allantgroup.com --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=Makefile all: compare REPS=50 STATICLOGS=static.total.log static.loop.log static.load.log DYNAMICLOGS=dynamic.total.log dynamic.loop.log dynamic.load.log LOGS=${STATICLOGS} ${DYNAMICLOGS} CFLAGS+=-Wall static: svd.o ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LDADD} dynamic: svd.o ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LDADD} clean: rm -f static dynamic ${LOGS} *.o .PHONY: run run ${LOGS}: static dynamic @rm -f ${LOGS} @reps=0; while [ $$reps -lt ${REPS} ] ; do \ time -p ./static 2>&1 >> static.loop.log | sed -ne '/real/s/real //p' >> static.total.log ; \ time -p ./dynamic 2>&1 >> dynamic.loop.log | sed -ne '/real/s/real //p' >> dynamic.total.log ; \ echo -n . ; \ reps=$$(($$reps+1)) ; \ done @echo @paste static.total.log static.loop.log | awk '{print $$1 - $$2}' > static.load.log @paste dynamic.total.log dynamic.loop.log | awk '{print $$1 - $$2}' > dynamic.load.log compare: ${LOGS} ministat -s static.load.log dynamic.load.log ministat -s static.loop.log dynamic.loop.log ministat -s static.total.log dynamic.total.log --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="svd.c" #include #include #include #include #define SIZE 1024000 int comp(const void *a, const void *b) { return memcmp(a, b, sizeof(int)); } int main(int argc, char *argv[]) { int numbers[SIZE]; int i; struct timeval tv1, tv2; gettimeofday(&tv1, NULL); srand(5); for (i = 0; i < SIZE; i++) { numbers[i] = rand(); } qsort(numbers, SIZE, sizeof(*numbers), comp); gettimeofday(&tv2, NULL); timersub(&tv2, &tv1, &tv1); printf("%ld.%06ld\n", tv1.tv_sec, tv1.tv_usec); return 0; } --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="stats.txt" ministat -s static.load.log dynamic.load.log x static.load.log + dynamic.load.log +--------------------------------------------------------------------------+ | xx + | | xx ++ | | xx ++ | | xxxx ++ | | xxxx ++ | | xxxx ++ | | xxxx ++ | | xxxx +++ | | xxxxx+++ | | xxxxx*++++ | | xxxxx*+++++ + | | xxxxx**+++++ + ++ | | xxxxx**+++++ ++ ++ + | | xxxx*****+++++++**+ ++ | | xxx******+*++++***+*++ ++ * x ++ + +| ||___M_A____| | | |______M__A_________| | +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 96 0.001561 0.027646 0.003969 0.0049661042 0.0040137086 + 96 0.003765 0.05356 0.00824 0.010588323 0.0072195082 Difference at 95.0% confidence 0.00562222 +/- 0.00165239 113.212% +/- 33.2733% (Student's t, pooled s = 0.00584085) ministat -s static.loop.log dynamic.loop.log x static.loop.log + dynamic.loop.log +--------------------------------------------------------------------------+ | + | | x + | | x + | | xxx+ + | | xxx+ + + | | xx xxx+ ++ + | | xx xxx+x *+ + + | | xx xxx*x **x + ++ | | xx xxx*x +*** + ++ + | | xxxx xx*** +***+++++ ++x | | xxxxxxx****++***+*+++++++x + + | |xxxxxxx*****+*******+**+*+x++++ + + x + + x + x+ *| ||________M__A___________| | | |________M__A__________| | +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 96 2.117437 2.946891 2.214953 2.2526589 0.13604786 + 96 2.196508 2.945064 2.305462 2.3386929 0.13174233 Difference at 95.0% confidence 0.086034 +/- 0.037884 3.81922% +/- 1.68175% (Student's t, pooled s = 0.133912) ministat -s static.total.log dynamic.total.log x static.total.log + dynamic.total.log +--------------------------------------------------------------------------+ | x + | | x x ++ | | x x ++ | | x x ++ | | x x + ++ | | x xx* ++ + | | x xxx* x+* + ++ | | xx xxx*x +*** ++++ + | | xxxx x***x++***++++++ ++ | | xxxxxxx*********+**+++ ++x ++ + | |xxxxxxxx************+***+**++++ ++ x + + x + * +x| ||________M__A___________| | | |________M__A___________| | +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 96 2.119 2.961 2.218 2.257625 0.13686538 + 96 2.208 2.952 2.313 2.3492813 0.13316888 Difference at 95.0% confidence 0.0916563 +/- 0.0382001 4.05985% +/- 1.69205% (Student's t, pooled s = 0.13503) --HcAYCG3uE/tztfnV--