🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2070

Re: Aggressive optimization

#2070
From: Herman Rubin
Date: Wed, 14 Nov 1990 13:50
20 lines
1619 bytes
In article <5810@lanl.gov>, jlg@lanl.gov (Jim Giles) writes:
> From article <7001:Nov1008:37:2690@kramden.acf.nyu.edu>, by brnstnd@kramden.acf.nyu.edu (Dan Bernstein):
> > [...]
> > Jim, you've made a blanket assertion that arrays are as efficient as
> > pointers. I've proven you wrong. Give up.
> 
> You have not even posted _one_ counter-example.  You have only
> posted things the the compiler _could_ have optimized the array
> version as well (or better than) your hand optimized pointer version.

Well, here is an example which will definitely not work on all machines.
It is desired to move 3 bytes into the three least significant bytes of
a 4-byte word (other sizes are appropriate), and repeat this operation.
This can be done efficiently by using pointers to words on a machine with
unaligned reads.  Even with overhead for unaligned reads, it is hard to
see how to do this efficiently otherwise.
-- 
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907
Phone: (317)494-6054
hrubin@l.cc.purdue.edu (Internet, bitnet)   {purdue,pur-ee}!l.cc!hrubin(UUCP)
Technical Details
Message-ID: <2732@l.cc.purdue.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!samsung!noose.ecn.purdue.edu!mentor.cc.purdue.edu!l.cc.purdue.edu!cik
References: <7001:Nov1008:37:2690@kramden.acf.nyu.edu> <5810@lanl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!samsung!noose.ecn.purdue.edu!mentor.cc.purdue.edu!l.cc.purdue.edu!cik
From: cik@l.cc.purdue.edu (Herman Rubin)
Newsgroups: comp.lang.misc
Subject: Re: Aggressive optimization
Summary: A non-portable example of pointer efficiency
Message-ID: <2732@l.cc.purdue.edu>
Date: 14 Nov 90 13:50:32 GMT
References: <7001:Nov1008:37:2690@kramden.acf.nyu.edu> <5810@lanl.gov>
Organization: Purdue University Statistics Department
Lines: 20