🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1331

Re: Compiler Costs

#1331
From: Jim Giles
Date: Wed, 11 Jul 1990 20:34
19 lines
1395 bytes
From article <1319@fs1.ee.ubc.ca>, by mikeb@salmon.ee.ubc.ca (Mike Bolotski):
> In article <2681@awdprime.UUCP>, tif@doorstop.austin.ibm.com (Paul
> Chamberlain) writes:
>> P.S.	Another good example is parity.  Takes about 25 instructions
>> 	in C, about 1 in assembly (using intel anyway).
> Deja voodoo. Lookup table.  3-4 instructions. Maybe less, depending on
> addressing modes available. 

Works just fine (but still slower than the assemble - by a lot) - provided
that you are doing parity checking of something _small_, like a single
byte.  The table gets kind of large for a 32-bit integer.  Similarly,
population counts and leading (trailing) zero (one) counts are not the
kind of thing that you'd want to do with table look-ups.  Of course,
no HLL I know of lets you inline assembly - the best solution.  _SOME_
implementations of C, Pascal, Fortran, even BASIC allow such inlining,
but the capability is not standard (makes your code - shudder - machine
dependent).

J. Giles
Technical Details
Message-ID: <56704@lanl.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!umich!yale!cmcl2!lanl!jlg
References: <1319@fs1.ee.ubc.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!umich!yale!cmcl2!lanl!jlg
From: jlg@lanl.gov (Jim Giles)
Newsgroups: comp.lang.misc
Subject: Re: Compiler Costs
Message-ID: <56704@lanl.gov>
Date: 11 Jul 90 20:34:02 GMT
References: <1319@fs1.ee.ubc.ca>
Organization: Los Alamos Natl Lab, Los Alamos, N.M.
Lines: 19