Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!alberta!mts.ucs.UAlberta.CA!Al_Dunbar From: userAKDU@mts.ucs.UAlberta.CA (Al Dunbar) Newsgroups: comp.lang.misc Subject: Re: Oh no! It's pointers vs arrays again! Message-ID: <2011@mts.ucs.UAlberta.CA> Date: 14 Dec 90 05:22:36 GMT References: <2392:Nov2902:59:0590@kramden.acf.nyu.edu> <7339@lanl.gov> <184a59d8.ARN0ebd@pilhuhn.uucp> <14651@smoke.brl.mil> <11@garth.UUCP> Organization: MTS Univ of Alberta Lines: 31 In article <11@garth.UUCP>, smryan@garth.UUCP (Steven Ryan) writes: >>has essentially only one form of data structuring, the array, while in >>C arrays are much less commonly used, other more appropriate data >>structures taking their place. Thus, while vectorization is important >>. . . > >I infer from this that chasing pointers throughout memory is considerred >a better programming practice. Pointer chasing is not only good for trashing >the cache but for thrashing virtual memory as well. <<>> >As far as machine efficiency is concerned, pointer chasing can require >fewer probes, but it is sequential and accesses memory randomly and >unpredicatably. Memory sweeping probes every item, but it is parallel >(or vectorisable) and accesses memory predicatably and sequentially. The only "randomly and unpredictably" aspects of how "pointer chasing" works is when someone tries to drive a C compiler without at least a learner's permit. Pointer operations in a "correct" program is completely predictable, in that the results achieved are correct. If you are concerned with the fact that the values of the actual addresses used in pointers is difficult to determine from reading the code, you may have missed the whole point of "abstraction". The address values are a detail that, like hexadecimal arithmetic, you can usually forget about. -------------------+------------------------------------------- Al Dunbar | Edmonton, Alberta | "this mind left intentionally blank" CANADA | - Manuel Writer -------------------+-------------------------------------------