Re: LW compiler optimizations
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Yes I pretty well understood what Martin has elucidated. Many years ago, when I wrote my NML language, I came quickly to the realization that, while modular array addressing was highly desirable, you don’t really want the basic access mechanism to pay the price. So the language was vectorized, and made an attempt prior to looping to determine the incremental segments in which raw basic access would accomplish your purposes. Copying or moving slices of arrays had a prep-stage where the actual move was decomposed into closures that handled each contiguous segment. And then a single function call launched that cascade of nested segment movers. I never really benchmarked its speed against alternatives. The performance was already quite satisfactory. But I will say that NML never had anything corresponding to displaced arrays. And in Lisp this is an elegant, if not speedy, addition to the language. Lisp always claims to have been designed by people that wanted the language to do the right thing - MIT versus Stanford. But there seem to be some odd omissions in that mission statement. > On Jan 20, 2025, at 12:46, Yuri Davidovsky (as work at disclosure dot ie) <[email protected]> wrote: > > Thanks, Martin, > > your response was quite enlightening and explains why we see the difference in performance well. It confirms the suspicion that we collectively came to that displaced arrays are a less preferred option when it comes to numerically intensive code. > > >> On 20 Jan 2025, at 20:07, Martin Simmons <[email protected]> wrote: >> >> In LispWorks at least, a simple 1d array is a single object, where the data >> follows the type information in memory. Displaced arrays are two objects, >> because you have the displaced array and the array that it references. That >> make aref more complicated. >> >> There are two additional complications: >> >> - You can have a chain of multiple displaced arrays, so aref has to loop in >> the general case until it reaches the simple array at the end of the chain. >> >> - In the case of adjustable displaced arrays, the displaced array can be >> changed on-the-fly to an array with a different size. We ensure that this >> on-the-fly change by adjust-array is thread-safe w.r.t. aref, which makes >> aref to more work. >> >> There is no type declaration to specify either of these complications, so aref >> has to assume that any non simple array might be a chain of adjustable >> displaced arrays. > > > _______________________________________________ > Lisp Hug - the mailing list for LispWorks users > [email protected] > http://www.lispworks.com/support/lisp-hug.html _______________________________________________ Lisp Hug - the mailing list for LispWorks users [email protected] http://www.lispworks.com/support/lisp-hug.html