home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!apple!cambridge.apple.com!cartier@math.uqam.ca
- From: cartier@math.uqam.ca (Guillaume Cartier)
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: map-array
- Message-ID: <9212111912.AA08784@mipsmath.math.uqam.ca>
- Date: 11 Dec 92 19:12:37 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 27
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
-
- <---
- | Based on the Code of Bill St.Clair for faster-climits I tried to write a
- | general map-array function,
- | both a mcl specific and a portable version.
- |
- | Then I compared this construct to mapc for sequences
- |
- | To my surprise, the mapping an array was slower than mapping over a list.
- | Am I missing something ?
- --->
-
- Yes!
-
- It is true that access to a specific element of an array in generaly faster
- than access to a specific element of a list. But, in this case, we are not accessing elements individualy but mapping over the whole structure.
-
- Mapping over an array involves accessing every element individualy (each
- time having to do at least a multiplication and an addition) where as
- mapping over a list involves simple pointer indirections which are very
- fast.
-
- *********************************************************************
- * Guillaume Cartier (514) 844-5294 (maison) *
- * L.A.C.I.M. (514) 987-4290 (bureau) *
- * Universite du Quebec a Montreal (514) 987-8477 (telecopieur) *
- * Montreal, Quebec, Canada cartier@math.uqam.ca (internet) *
- *********************************************************************
-