Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jul 2003 01:18:07 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern init_main.c kern_malloc.c md5c.c subr_autoconf.c subr_mbuf.c subr_prf.c tty_subr.c vfs_cluster.c vfs_subr.c 
Message-ID:  <16372.1058915887@critter.freebsd.dk>
In-Reply-To: Your message of "Tue, 22 Jul 2003 16:07:31 PDT." <20030722230731.GB61493@athlon.pn.xcllnt.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030722230731.GB61493@athlon.pn.xcllnt.net>, Marcel Moolenaar writ
es:
>On Wed, Jul 23, 2003 at 12:56:34AM +0200, Poul-Henning Kamp wrote:
>> 
>> And the only two criteria I think are trivial to use for proving an
>> actual benefit is:
>> 	1. less code is generated.
>> 	2. it runs faster in tests.
>
>criterium 1 is the worst possible. Only criterium 2 makes sense.

No, if inlining a functions results in less code overall it also,
ipso facto results in faster execution.

Ie:

	A calls
	B bytes instructions in target function
	C bytes to setup args to target function
	D bytes target function overhead (stack frame etc)

   Not inlined:

	X = A * C + D + B

   Inlined
	
	Y = A * C - optimizations + inlining overhead

   If Y < X, then you have by definition a performance gain.

...even on highy ornamental CPUs like Convex vector engines and
the ia64.

>The old gcc metric of less code is better has been demonstrated
>to not work in general nowadays.

Make sure you don't compare apples with oranges.  We are not talking
about what kinds of optimizations the compiler performs, we are
talking about the code you give it to perform on.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



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