by reikonomusha · 7y ago · 0 comments
The blasé attitude toward adhering to POSIX/GNU wc behavior was a bit dissatisfying to me. Those additions are “trivial” and probably don’t change the shape of the program too much, but are nonetheless complicating and time-consuming factors. I would prefer that Lispers strive to complete 100% of the job, not the 80% cut that matters to them. :)
With all that said, I agree with the opinion of the article, being preferable to write Lisp over C, though I would be up-front about the meaning of “beating C”. C has been beat—in my and the author’s opinion—because Lisp strikes an unusually good balance between execution efficiency, speed of development, program safety, and expressiveness. But even better, Lisp lets you push in any of these directions, often with only modest sacrifices in the others.
However, the original spirit of the wc exercise was to make it fast, Benchmarks Game-style.
Which I don't see what the point of the article is then. It's just some guy ranting about his preferences I guess. Which is fine, but like... lead with that.
I wrote it in reply to an earlier post, where someone "beat C" with Haskell.
alx@foo:~/Git$ time ./wc/threads 1 twc/big.txt
128457 1095695 6488666
real 0m0.022s
user 0m0.022s
sys 0m0.000s
alx@foo:~/Git$ time ./twc/twc twc/big.txt
128457 1095695 6488666 twc/big.txt
real 0m0.037s
user 0m0.025s
sys 0m0.012sThat being said, even with all the extra stuff it's doing, I'd assume it to perform roughly as well as your single-threaded version (when you use a non-multibyte locale to keep the comparison even remotely fair).
[1] compiler https://github.com/rigetti/quilc
[2] simulator https://github.com/rigetti/qvm
Once upon a time
https://salsa.debian.org/benchmarksgame-team/archive-alioth-...
https://web.archive.org/web/20010616231931/http://www.bagley...
The reason I didn't strictly adhere to the POSIX behavior was because I don't know where this is documented and don't feel like scanning through the C to find out. On all of the files I've tested, which include a wide array of punctuation and other such things, the results were identical, but I'm merely not making any promises. I'd prefer to not be accused of being one of those Lispers who only complete part of the program; if you look at the libraries I've written, which actually concern me, then you'll find they're well-documented and rather comprehensive for their purposes.