Home  >  Article  >  Backend Development  >  Common Lisp VS C: a testimony

Common Lisp VS C: a testimony

王林
王林Original
2024-07-18 11:58:27602browse

Common Lisp VS C: a testimony

I like testimonies. Here's one on Lisp vs C. About execution time, speed of development, length of programs, ease of development.


I find SBCL produces highly performant code, and is even faster with a small number of well-placed type declarations. I have a Lisp vs C story: I'm a mathematician and was doing some research on the Cops and Robbers game in graph theory with a friend of mine who is a computer science professor and has worked in the past as a professional programmer. We needed some data on which graphs have winning strategies for the cops and decided to independently write code to compute them so we could vet the results against each other.

I wrote my code in Common Lisp and ran it with SBCL; he wrote his code in C.

My program was 500 lines and his was 4,000 lines. My program was faster than his and it's no mystery why: I tried several different optimizations my friend also thought of, but didn't implement because it would have been another 1,000 lines or so. I also find my program much more readable than his, just because of the length: even if you are 5 times as fast at reading C than Lisp, his program is still 8 times as long!


by @oantolin@mathstodon.xyz on Mastodon (https://framapiaf.org/@oantolin@mathstodon.xyz/112746475805471440)

and... that's it o/

The above is the detailed content of Common Lisp VS C: a testimony. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn