🐫 New Fleaswallow, SourceHut πŸ€–

Monday, February 17, 2020 :: Tagged under: engineering works pablolife. ⏰ 4 minutes.


Hey! Thanks for reading! Just a reminder that I wrote this some years ago, and may have much more complicated feelings about this topic than I did when I wrote it. Happy to elaborate, feel free to reach out to me! πŸ˜„


🎡 The song for this post is Piel Canela, by Natalia y La Forquetina. 🎡

Sapo, hanging out in bed, next to my feet with socks that look like him. Click for full size.

Get blessed with some Sapo.

I wrote some fixes/updates for Fleaswallow, the OCaml static site generator I made that builds this site. The "headline" feature is incremental builds. Given past experience with other site generators in dynamic languages (Frog, Octopress) I thought when building Fleaswallow that I'd need some kind of cache for incremental builds to make it pleasant. Turns out I didn't! Tech choices matter, and OCaml is delightfully performant, in a class just under C and Rust. Builds of the site took less than a second.

And then… that changed. My site was taking 5, then 10 seconds to build. It was manageable, of course, but I didn't like it. So I spent much of Sunday adding incremental builds, which changed virtually every type signature, and required a fair bit of tweaking. At first I was bitter about having to dig into OCaml I'd mostly forgotten, but later hit my "runner's stride" and am glad with how it turned out.

Takeaways:

Most lessons only stick after you learn them the hard way, so you already know this, but always profile before you optimize. It turned out that the incremental builds of the site didn't speed it up, because I was entirely wrong on what was slowing it down. I thought it was the IO of writing hundreds of files, but it was actually just copying the directory with all the static files. All those fancy video files I've uploaded (mostly for Celeste highlights) were slowing it down, not the site-building, which was more-or-less still instantaneous (my misunderstanding is also a function of the logs it emitted, and taught me a bit about log design).

Tweet by mcclure111: "Rust infuriates me no end because it's like somebody made a language which is bullet-point-for-bullet-point all the things I want in a programming language, and I took one look at it and realized I hate the things I want"

I CAN'T RELATE AT ALL

OCaml is getting more and more pleasant with practice. Most of my favorite tools are, to use Evan Miller's term for Erlang, "back-loaded:"

most of the language's benefits can only be appreciated after several years with other languages followed by several years with <language in question>. It is certainly not a language for beginners.

If you couldn't tell from my primal scream on OCaml's tooling, I wouldn't wish this on my worst enemy. But, now that I'm here, it's really pretty amazing how nice it is. Fleaswallow still doesn't have tests lol. Part of that is because the testing story is awkward in OCaml (I'll learn it someday) but the truism "if your program typechecks it's often pretty close to working" still holds true. Designing the cache in line with what the codebase already had was a bit challenging, but after I got that design in typechecked code, it didn't have any major bugs.

Getting to that state was a colossal pain in the ass compared to something like Python or Elixir. But after spending 10 minutes writing Python application code but spending 50 more getting the mocks right on the tests, I'll take this tradeoff.

Fleaswallow's not really ready for anyone else to use, but we're getting closer. This is a weird project of mineβ€”I have very few code cycles to give after the startup work, and the few that I have I should probably give to Amado. But this makes working on Fleaswallow something of an indulgence. One of my favorite things said about software comes from my best friend Saurya:

Becoming a software engineer because you love coding is a lot like becoming a butcher because you love animals.

and, well, a weird static-site generator for nobody else but me makes me feel like I'm at a petting zoo. It reminds me why this is fun, actually.


If you click on any of the Fleaswallow links above, you'll note that it's hosted on SourceHut. I talked about sr.ht in my self-hosting post as something I'd like to try; in practice, it turned out to require a fair bit of setup, and I wasn't even sure I'd like it. I almost caved and installed Gitea or Gogs. But I respect Drew's work, share many of his computing aesthetics, and like what he's trying to do, so I'm moving a lot of my repos over there to "try before I buy" on self-hosting it myself. I'll probably move more repos there soon.

Thanks for the read! Disagreed? Violent agreement!? Feel free to join my mailing list, drop me a line at , or leave a comment below! I'd love to hear from you πŸ˜„