3 ms·
Bears mentioning that Piet is "faster than C" if you use the right compiler. https://github.com/boothby/repiet/blob/master/README.md#but-is-it-faster-than-c ht
by boothby 7y ago
Bears mentioning that Piet is "faster than C" if you use the right compiler.
https://github.com/boothby/repiet/blob/master/README.md#but-is-it-faster-than-c https://github.com/boothby/repiet/blob/master/README.md#but-...
Among the esoteric languages I've learned, Piet is by far, hands down, my favorite. But it's curiously opinionated about reading input. I don't think any interpreter / compiler gets it right, mine included. Painting (one does not write) Piet code to safely handle input, by that spec, is particularly annoying.
- tess0r 7y agoI agree. I've written an interpreter in rust [1] and input handling, esp for numbers, was really annoying. I guess the best reference for implementing new interpreters is npiet and testing all example images. [1] https://github.com/tessi/rpiet https://github.com/tessi/rpiet
- boothby 7y agoCool, I haven't seen your interpreter! I'll have to give it a read through. npiet is good, and I use its examples for testing, but FYI it diverges from the spec in how it handles whitespace. According to DMM, if the cursor enters a loop entirely within whitespace, the program should terminate. Currently, npiet doesn't have a cycle-detection algorithm so it hangs. One of these days I'll get around to making my test infrastructure and polishing up my tests... but I've recently had some weird thoughts about a place&route algorithm to replace my existing Piet backend and that's more interesting. First step, design a router that creates right-hand-rule paths through whitespace? What am I even doing with my life...
- markemer 7y agoOne of these days we’ll need to get IEEE to formalize a standard.
- tess0r 7y agoI implemented my interpreter with the goal to learn some rust. So please let me know should you find things to improve :) I remember a point in development when I implemented whitespace handling and cycles therein. I thought I had implemented the spec but some example programs did not run properly. Maybe that was because of the divergence in the spec vs. npiet you mentioned. Since my main goal was to learn rust I just made the example programs work and did not double check the spec again. Will look into it again when I find some time :)
- downerending 7y agoC is also "faster than C" if you use the right compiler.
- shakna 7y ago> Well, let's back up a minute for the folks missing context. Recently there have been a spate of blog posts of folks claiming that their pet language is "faster than C" by implementing a feature-incomplete version of the wc utility and running a single benchmark to demonstrate superiority. I believe they are well aware of the limitations that have been shown in these recent benchmarks, and that it doesn't in fact demonstrate superiority in any way.
- boothby 7y agoWell yes, the example uses a C backend and everything. repiet wc.png -o wc.c --backend c --codel_size 10 -O 2 gcc wc.c -o wc -O3 I hacked it together in response to a "brainfuck is faster than C" HN post and stale jokes don't die on my watch.
- downerending 7y agoI, too, was joking. Mostly. :-)