Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Mar 2003 14:54:47 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Mark Murray <mark@grondar.org>
Cc:        Peter Jeremy <peterjeremy@optushome.com.au>, chat@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/i386/string Makefile.inc wcscmp.S
Message-ID:  <3E6D17B7.5FDCEAFC@mindspring.com>
References:  <200303102237.h2AMb3Ig074356@grimreaper.grondar.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Mark Murray wrote:
> > In general, the best optimisations are achieved at a much higher level
> > than compilers can easily achieve.  My favourite example of this is
> > the original code for compress(1) - which turns about 1/2 page of C
> > code into a single VAX instruction.  You're not going to get a compiler
> > to recognize this level of equivalence.
> 
> I'm guessing that this means there will always be room for humans to
> hand-code assembler. How far can this be made redundant, given that
> there is still lots of effort going into hand-coded asm functions?

I think that in all cases where it's possible, you want to have
C language equivalents.  Yeah, they are slow, but they are also
portable.  It's really a pain to try to go to a new architecture
when there's all this assembly language code lying around.  At the
very least, you want there to be both platform independent and
platform dependent versions of the code.

Otherwise, nothing beats a good human for highly optimized assembler;
with the exception of certain RISC architectures, where the wins are
all about instruction scheduling, it's really hard for a compiler to
beat a motivated human.  Even with PPC or Alpha, a highly knowlegable
human can still beat compilers, if they are fully aware of the need
for instruction scheduling.

It all really boils down to what you're willing to invest for small
marginal speed improvements.  If it's overhead on every system call,
you care about it.  If it's overhead on every process startup, you
probably care about it a lot less.  If it's overhead on the system
boot, which gets executed once every 50 days or so, then you probably
don't care at all.  8-).

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




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