4 ms·
> Python has multiple inheritance; JS doesn't All these specific examples are true statements, yet isn’t Common Lisp even more dynamic, and often have even bet
by ken 7y ago
> Python has multiple inheritance; JS doesn't
All these specific examples are true statements, yet isn’t Common Lisp even more dynamic, and often have even better optimizing compilers?
Lisp has multiple inheritance and also multiple dispatch, and SBCL beats CPython by a country mile in every performance comparison I’ve seen.
- cat199 7y ago> SBCL beats CPython I always find it ironic that the CMUCL lisp compiler (upon which SBCL was based) was called 'the python compiler', had machine-code generation in 1992 and that CMUCL sports native multithreading that is largely lock free.. https://www.researchgate.net/publication/221252239_Python_compiler_for_CMU_common_Lisp https://www.researchgate.net/publication/221252239_Python_co...
- chubot 7y agoHm that's a good question, not sure. Do Common Lisp implementations have a "core" that multiple inheritance and multiple dispatch can be desugared to? Or are those features "axiomatic" in the language? If it's the former, I would say that optimizing a small core is easier than optimizing a big language. Python's core is 200-400K lines of C and there are a lot of nontrivial corners to get right. I was surprised when looking at Racket's implemetation that it's written much like CPython. IIRC it was more than 200K lines of C code. Some of that was libraries but it's still quite big IMO. I would have thought that Racket, as a Scheme dialect, would have a smaller core. AFAIK Racket is not significantly faster than Python; it's probably slower in many areas. Maybe it's just that SBCL put a focus on performance from the beginning? (I looked at Racket since I heard they are moving to Chez Scheme, which also has a focus on performance.)
- cat199 7y ago> (I looked at Racket since I heard they are moving to Chez Scheme, which also has a focus on performance.) to wit, chez scheme was several generations into improving it's native code compilation abilities before python even existed: history of chez scheme (2006): https://www.cs.indiana.edu/~dyb/pubs/hocs.pdf https://www.cs.indiana.edu/~dyb/pubs/hocs.pdf
- flavio81 7y ago>Do Common Lisp implementations have a "core" that multiple inheritance and multiple dispatch can be desugared to? Yes, that's the Meta Object Protocol. It isn't on the standard, yet most Lisp implementation have it, and now you can use it in a portable way as well. >If it's the former, I would say that optimizing a small core is easier than optimizing a big language. Python's core is 200-400K lines of C Common Lisp's "core" (that means, not including "batteries") is considerably more involved and complex than Python's. Creating a new CL implementation is a big deal.
- soegaard 7y agoI expect Racket to be faster than CPython: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/racket-python3.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... Note that the old C runtime of Racket has been rewritten to use Chez Scheme. The work is not completely done - but it is getting close. Talk by Matthew Flatt on the rewrite (almost a year old): https://www.youtube.com/watch?v=t09AJUK6IiM https://www.youtube.com/watch?v=t09AJUK6IiM
- flavio81 7y ago>SBCL beats CPython by a country mile in every performance comparison I’ve seen. This. Lisp at least 10x faster in the worst case; it can be made to run even faster...
- kazinator 7y agoA while ago someone made this Reddit post: https://www.reddit.com/r/learnlisp/comments/bskmcg/speed_comparison_python_interpreter_lisp_gcl/?st=k0hmkk6m&sh=72cba2ea https://www.reddit.com/r/learnlisp/comments/bskmcg/speed_com... The user was comparing some Ackermann computations using Python and GNU Common Lisp (GCL), finding the performance about the same. But he wasn't compiling the Lisp! So this compared GCL's Lisp raw AST interpreter to Python byte-code.