[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: map-array
- To: poeck@informatik.uni-wuerzburg.de (karsten poeck)
- Subject: Re: map-array
- From: cartier@math.uqam.ca (Guillaume Cartier)
- Date: Fri, 11 Dec 92 14:12:37 -0500
- Cc: info-mcl@cambridge.apple.com (Macintosh Common Lisp)
<---
| 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) *
*********************************************************************