Re: Performance assistance / advice
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Well, one of the main reasons I write Lisp is so that my code runs the same way on multiple different architectures, eg, AMD Rizen and Apple Mx. If I had to write in C it would drive me crazy with all the non-numeric computations needed - OS API, queues, lists, vectors of arbitrary structs, etc. And then there is GC and graphics, etc, etc, etc. No thanks! I’ll gladly buy the slightly reduced performance of LW and use a faster machine. Not to mention the ease of trying algorithm variations. For me, getting within 2x of hand crafted C code is sufficient, given the lack of alternatives. Python? You can’t be serious. That is for lamer physics people coming from CERN. > On Mar 11, 2025, at 13:42, Yuri Davidovsky (as work at disclosure dot ie) <[email protected]> wrote: > > > >> On 11 Mar 2025, at 21:31, Tim Bradshaw (as tfb at cley dot com) <[email protected]> wrote: >> >> Well, this is actually my claim here: yes, like C fast. I am secretly hoping that some masochist will write a version of my algorithm in C, so I can verify this. > > Unfortunately, it won’t be the case in all situations. For example, as outlined above, gcc is quite good at automatic vectorisation, Lisps’ capabilities at that are rather rudimental at this point in time, as I understand. Additionally, when coding in C you can have access to intrinsics (wrapper functions for underlying CPU instructions) which can give you a bit of an edge when optimising for a specific platform, for example the rbit instruction on arm64 that does bit reversal and that is strangely not present on x64 and which can save a lot of cycles. > > Moreover, you do not even explicitly need to use the intrinsics, gcc can recognise the bit reversal algorithm patterns and employ the rbit instruction even without you knowing about its existence. At the moment such things are not possible in lisps, so in some cases inability to match C’s performance is going to be difficult to even explain, let alone to replicate. > > _______________________________________________ > 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