by lisper · 5y ago · 0 comments
> Given that the participants were recruited from internet groups, I doubt that the subjects were monitored in place, which makes me think that the Development time data collected should be taken with a giant grain of salt.
> Based on a small study like Garret’s, I find that the premise that Lisp is so great is unwarranted.
That's a fair criticism. In my defense I will say that I didn't actually claim that Lisp is great, only that it seems plausible that it might offer the development speed and runtime safety advantages of Java and the execution speed of C, and so it is worth paying some attention to it, and maybe doing further studies. I certainly believed (and continue to believe) that Lisp is great, but I certainly concede that my data didn't (and doesn't) prove it. Renato seems to agree:
> However, the data does suggest that Lisp is about as productive as the scripting languages of the day and has a speed comparable to C and C++, which is indeed a remarkable achievement.
FWIW, my study was a throwaway side-project conducted on the spur of the moment in my spare time. It was intended more to get people's attention and make the case that Lisp ought to be considered alongside Java as an alternative to C than to be a rigorous scientific case for Lisp's superiority over Java. At the time, Lisp was quite a bit more mature than Java, and indeed one could have argued (and indeed could argue today) that Java was an inferior re-invention of many of the ideas that Lisp had pioneered, with automatic memory management being at the top of that list. I was frustrated that Java was getting all the attention because it was the shiny new thing and Lisp was being ignored because at the time Java actually sucked pretty badly. (IMHO it sucks pretty badly today too, but that is now a much harder case to make.)
In any case, what astonishes me most is that AFAICT no one has ever done a follow-up to either of these studies that was better designed and used more rigorous methods. Instead, people just seem to keep citing these papers again and again as if squeezing these turnips harder might yield something worthwhile now that could not be extracted from them when they were first published.
This is a very fertile field for further research. Someone should cultivate it.
[1] Took him three months to port it. [2] A 50% difference in speed usually doen't cause firmware to fail performance metrics.
A typical Lisp bytecode is more compact than typical FORTH threaded code because most of the operations are one byte, and common operations are assigned several bytecodes. (For example, you might have four bytecodes for function invocation with no arguments, one argument, two arguments, and three or more arguments; the last one takes the argument count from the stack or from a separate byte in the instruction stream.) In ordinary FORTH threaded code, every operation is two bytes (or maybe four on a big computer), but you probably want to implement "token threading" if you're trying to do it on a PIC, which ends up being the same thing.
That part of the interpreter, the part that's hard to implement because you're writing it in PIC assembly and want it to run fast while using a space-efficient encoding, almost can't tell whether you're writing FORTH or Lisp, because all it's interpreting is strings of stack bytecode. The big difference is the garbage collector: in FORTH you don't have one, normally. But you can write Lisp without a garbage collector, too, and if you're running on a PIC you probably want to do that.
Also compressing a large program into a small computer by having a part of the program written in compact interpreted code dates back at the very least to Apollo's Guidance Computer's INTERPRETER component.
Of course Turing's original hypothetical Universal Machine from 01936 is "universal" precisely because it is an interpreter that can emulate any computing machine, most importantly including itself, but you could reasonably object that Turing didn't actually build a working Universal Machine in the 01930s, and at any rate he wasn't concerned with the question of how to fit a lot of functionality into a small amount of RAM.
I've seen references to "Turing's 'short code'" and to "ENIAC Short Code" but I am not sure if they are things that really existed or if someone was just getting their references confused.
Lisp as a language is much more malleable to the problem at hand. This will mean it will attract a small group of smarter people, but create code which is harder to read and hence harder to give to other people. Hence, lisp programs tend be smaller, more creative, better quality, faster to create, but also to stagnate when their creators leave.
Java, more recently Go, and maybe even Cobol, attract a bigger group of more average people. They'll write in a simpler, more standardized style. The programs tend to be more bureacratic, average, less optimized, but also much more readable. They are the better choice when you need maintainability over a long time by a varied group of programmers.
I don't remember where this came from, it's certainly not my own idea. It doesn't sound completely bollocks, but have no idea if its true or not.
Lisp is tremendously powerful, and like all power, it can be abused. But when used properly it can produce some very easy-to-read and maintainable code precisely because of its malleability.
Take a look at this for example:
https://flownet.com/ron/lisp/djbec.lisp
In that code I used an embedded an infix parser and macros to allow me to write modular bignum arithmetic expressions as infix. That lets me cut-and-paste the infix versions of elliptic curve point addition algorithms and use them directly without translating them into s-expressions, which eliminates the possibility of transcription errors. The resulting code is much easier to read than if I'd had to actually translate all the modular math into standard Common Lisp.
Java programs often have so many classes, methods and interfaces that it’s hard to comprehend the overall flow of the application. Terse languages (lisps and MLs come to mind) can often solve the same problem in a single page.
Terseness that comes from powerful expressions (simple SQL queries can replace lots of code in any language) is great, though terseness just in the form of density shouldn't necessarily be a goal. At my last job the worst Java code was the most dense, with huge methods spanning hundreds of lines and sometimes up to 10 levels of indentation. Sure it's all there, but it's hard to understand everything it's doing (and more importantly why), impossible to cover with good tests, very difficult to refactor because of so many implicit dependencies you have to untangle first (and there are higher priority items), no justified pressure against "just adding one more conditional" to the middle of some big method to satisfy some new requirement from somewhere (so long as the tribal knowledge exists about where such code ought to be placed anyway, it'll take anyone new a long time to find out from scratch), and so much dense code in many core infrastructure areas was initially written by a superstar coder over a decade prior -- if he ever left the company, a lot of things would break with no one to fix them in a reasonable amount of time, he has so much institutional knowledge and no time or pressure to document it all if such a thing were even possible.
Out of control ravioli code on the other hand was relatively easy to wrangle back under control -- my favorite was a huge logging framework written by a Principle level employee that actually wasn't used by anything, not even its supposed log() entry point, so it was just a big no-op, and could be deleted.
The hardest parts of maintaining software aren't the difficulties in understanding a clever piece of code using advanced language features, but just the sheer complexity of computation being expressed. This is part of the essence that has even a few old time Lispers saying things like "language doesn't really matter" -- nevertheless, I think CL pressures reduce complexity and difficulty of understanding more so than Java, and still decades later has better tools to pierce the veil when understanding is difficult. (Monitoring tools, not as much, though well-understood code tends to not need as much monitoring.)
But I at least want to master the most powerful general-purpose language they’ll let me use, because that investment will keep paying off until I find one that’s better still.
<... Lisp’s performance is comparable to or better than C++ in execution speed ... it also has significantly lower variability, which translates into reduced project risk.
Furthermore, development time is significantly lower and less variable than either C++ or Java.>
Then, towards the end of the article, the author says:
<Quite unexpectedly, Common Lisp was the best language overall,...>
How was that unexpected?
Which implementation of Lisp did you use and how did you build/deploy the code? How idiomatic the code was? e.g. was it C-like code but in S-expressions? (imperative, for loops, in-place modifications, no high level abstractions, etc... but I guess this also might count as "idiomatic Lisp" in some circumstances)
I can tell you this: I currently have a consulting gig where I help maintain a tool for designing state-of-the-art ASICS which is written in Allegro Common Lisp. It is definitely competitive with C in terms of run-time speed.
https://www.researchgate.net/publication/1922338_Plat_Forms_...
I will say, however, that IMHO just about anything is better than C++, including C.