RC Week 3: Returning to Math

Saturday, October 8, 2022

The third week of my batch at Recurse Center is finished. It is still flying by too quickly. Nine weeks left!

This week was a whirlwind and really busy. I think I pushed myself too hard. I had just recovered from my cold and was a little drained, and then got my COVID booster and flu shot, which really knocked me out. But I got a lot done, and I'm going to focus on self-care a little bit more next week.

The most exciting thing this week is probably that I'm taking a turn back toward math! I joined the category theory group at RC ("Category Theory Catacombs") where we're working through the Programming with Categories course. This was a little intimidating to me before I started it, because it's been the better part of a decade since I have attended a math lecture. For some reason I decided to join since I was taking an easy day "off" after my vaccine, so I would just watch some math lectures.

It turned out to be the highlight of my week and reminded me the joy of approaching things from a mathematical perspective. I need more of this in my life, so a few of us are also going to start exploring theorem provers and working through Theorem Proving in Lean. I'm so excited to continue going down this path.

Besides that, I did get some things done that I'm pretty proud of:

  • Implemented INCR/DECR in anode-kv
  • Benchmarked anode-kv against redis and found very favorable results (we will see how these hold up over time though, as features get added!)
  • Had at least one pairing session a day and at least one coffee chat a day
  • Wrapped up the first pass at a GUI frontend for patzer (my chess program)
  • Fixed an irritating boot drive issue with my server, so now it doesn't need to be babysat after a reboot

I have some capital-T Thoughts about immediate mode GUIs now, and the particular one I'm using, but those are best saved for another blog post that may or may not come to fruition. I don't know how coherent those thoughts are, but I'm pretty frustrated right now with this library. I'm proud of where I've gotten with it, though!

I'm also really proud of anode-kv so far. The core architecture is based on what I read in Architecture of a Database System, and it seems to be effective! Right now it can pass 1.7 GB/s through it in my test environment, contrasting with 360 MB/s for redis (with durability off, for a more fair comparison). The bulk of the time is spent in network syscalls and memory allocation/deallocation. I think there's room to speed things up, but also... there will be more pressing, more important performance problems after implementing durable storage.

One of my big takeaways with my performance work at RC so far has been reinforcing a couple of things I've heard before:

  • Estimate bounds before you benchmark: Estimating theoretical bounds or pragmatic "good enough" bounds before benchmarking is helpful for understanding both (1) if your benchmark is working, and (2) if it indicates good enough or a problem.
  • Profile before you optimize: I expected the memory copies that I do to be expensive, but it turns out that they're not so bad in terms of the overall performance.

It might be a fun exercise to profile redis itself to see what it's doing that's making it slower than anode-kv. Maybe that's on the docket for the next week or two!

What's next week?

Okay, so next week I want to:

  • Keep pairing every day, keep coffee chats every day
  • Make progress on patzer:
    • Implement basic board evaluation (dumb strategy first: material count)
    • Implement one slightly better search algorithm like minimax
  • Make progress on anode-kv:
    • Implement durable storage and see how it performs (naive implementation first!)
    • Implement set and hash operations
  • Read another Red Book paper
  • Learn some category theory
  • Learn some Lean
  • Go to some of the fun/weird/quirky programming events

But I'm going to be more flexible than usual with my plans next week. I'll be visiting family in Ohio, and my wife's going to a conference, so I might be off kilter or interrupted more. And that's fine!


That's all for this week. It's been a long week, and I have to go pack up to travel tomorrow and get some sleep. I hope you have a great rest of your weekend!


If you have comments, questions, or feedback, please email my public inbox. To get new posts, please use my RSS feed.