home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / lisp / mcl / 1829 next >
Encoding:
Internet Message Format  |  1992-12-11  |  1.5 KB

  1. Path: sparky!uunet!stanford.edu!apple!cambridge.apple.com!cartier@math.uqam.ca
  2. From: cartier@math.uqam.ca (Guillaume Cartier)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: map-array
  5. Message-ID: <9212111912.AA08784@mipsmath.math.uqam.ca>
  6. Date: 11 Dec 92 19:12:37 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 27
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11. <---
  12. | Based on the Code of Bill St.Clair for faster-climits I tried to write a
  13. | general map-array function,
  14. | both a mcl specific and a portable version.
  15. | Then I compared this construct to mapc for sequences
  16. | To my surprise, the mapping an array was slower than mapping over a list.
  17. | Am I missing something ?
  18. --->
  19.  
  20. Yes!
  21.  
  22. It is true that access to a specific element of an array in generaly faster
  23. 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.
  24.  
  25. Mapping over an array involves accessing every element individualy (each
  26. time having to do at least a multiplication and an addition) where as
  27. mapping over a list involves simple pointer indirections which are very
  28. fast.
  29.  
  30. *********************************************************************
  31. * Guillaume Cartier                 (514) 844-5294 (maison)         *
  32. * L.A.C.I.M.                        (514) 987-4290 (bureau)         *
  33. * Universite du Quebec a Montreal   (514) 987-8477 (telecopieur)    *
  34. * Montreal, Quebec, Canada          cartier@math.uqam.ca (internet) *
  35. *********************************************************************
  36.