A model for self-destructive behaviour

…people may engage in self-destruction even if it doesn’t make them happy because it makes them right about how the world works, and that’s more important to a mind that runs on predictive processing.

From https://srconstantin.wordpress.com/2018/11/11/she-wanted-it/

Oh man does this a) resonate and b) explain a lot.

Advertisements

We Are What We Read / Bitcoin and Lovecraft

Somebody, somewhere, has mashed up an internet thinkpiece on bitcoin with weird near-future sci-fi and mind-bending Lovecraftian horror. It is the internet after all.

However many examples of the above already existed (it is the internet after all!), there is one in particular that I read recently, over the course of a roughly two-hour train ride.

Read with caution: https://zerohplovecraft.wordpress.com/2018/05/11/the-gig-economy-2/

I don’t know exactly where it came from or who wrote it; the blog that posted it has no other information and only one other (protected) post, apparently a draft of the public version. This anonymity is suitably in-character and probably deliberate. I found out about the story through this Slate Star Codex post; I would not be at all surprised if Scott Alexander is behind the whole thing and just didn’t want it directly associated with that online identity for some reason.

I won’t go into the story itself really at all, there’s not a lot of it I could do justice to and while “read with caution” is entirely accurate, it is absolutely worth reading. Instead I want to talk about what reading does to us.

For some time after I’ve read something truly absorbing, the imprint of that work stays with me, echoing through not only my thoughts but also my speech patterns, word choice, and something which I struggle to describe other than as “the shape of my consciousness”. For example, I’m a big fan of Patrick Rothfuss’s The Name of the Wind and its sequels (collectively The Kingkiller Chronicle). Rothfuss has a very distinctive, very fluid style of prose, often characterized by lists without the typical join words like “as” or “his”. From the first page of the first chapter of The Name of the Wind:

They had taken his sword and stripped him of his tools: key, coin, and candle were all gone.

Note the lack of repeated “his” before the descriptive list, and also the alliteration. From a few pages later:

It was a spider as large as a wagon wheel, black as slate.

Note the lack of “and as” before the word “black”. I’m not even sure if this sentence as written is technically correct, but it’s clear enough and the overall effect of an entire book constructed this way is beautiful. Language is descriptive not prescriptive anyway.

It’s easy to understand how reading some 1200 pages of this prose might impact one’s own speech patterns. I’ve gone through the available books a couple of times over the years, and every time I’ll spend a week or more afterwards speaking just like Rothfuss writes: terse, eloquent, fluid.

[J]ust like Rothfuss writes: terse, eloquent, fluid.

See? I’m doing it here after just talking about it.

But as I mentioned, it goes beyond just word choice and sentence structure. I already mentioned “the shape of my consciousness” and I stand by that vague gesture towards something I can’t otherwise pin down. Although I do have a small poetic and flowery streak, I am not normally given to purple prose, but for some time after I’ve read Rothfuss I won’t just speak it; I’ll think it. Something about the shape of the sentences, the word choices, demands that adjectives and nouns come in sets, which means I use more of them than I otherwise would. This gives everything more shape than it would otherwise have, and paints a richer picture of the world.

I make different decisions as a result. I am a different person.

This is, I suppose, just a really complicated way of saying “this book changed my life”! That’s not an incorrect interpretation. But really, I’m arguing anecdotally for the Sapir-Whorf hypothesis.

I’m doing that, just to be able to say: that “The Gig Economy” story did some weird things to my brain. I’m glad I didn’t have to interact with other humans for a while afterwards.

Theoretical Fun

The company I work for, like many other tech companies, has a thing where you get to spend a certain amount of your time working on projects of your own choosing. The most well known-example of this is Google’s now-defunct 80/20 rule but there are plenty of others.

This past week I had an opportunity to do some of this, and ended up brushing off my very theoretical computer science roots and digging into some graph theory in order to solve a very practical problem. Of all the things I get to do in software, this is far and away my favourite, and I had a blast working out the possible solutions.

In my career so far I’ve been lucky enough to have several opportunities to solve problems of this nature and then build out the solutions, and even publish some of them to talk about. It is extremely rewarding work. There are of course a few I can’t talk about as they are still internal, but here’s a sort of “hall of fame”: two other problems that I had a ton of fun solving at a computer-science-theoretical level and also resulted in really awesome (and sometimes popular!) practical solutions.

Wheel-of-Fortune Memory Allocator

https://github.com/eapache/wof_alloc

Arguably the overarching project here was Wireshark‘s wmem framework which I also designed and built, but while wmem was a lot of fun to work on it wasn’t particularly novel; it was just another memory pool library with a few minor tweaks to suit Wireshark’s use case and migration path. However, Wireshark’s unique memory allocation pattern demanded a custom allocator algorithm which I eventually extracted into this library.

As far as I can remember this was the first practical problem of this nature that I got to take the entire way: from identifying the problem, designing the solution, to building and shipping it, and I am forever grateful to the Wireshark core team for trusting a (at the time) university student to go and rewrite the deepest foundational layer of the project. At just under 1000 lines of pure C this allocator has been shipping in released versions of the project for 5 years now effectively unchanged, and the standalone version gets a fair number of hits on GitHub.

Sarama Async Producer

https://github.com/Shopify/sarama/wiki/Producer-implementation

A little while later, my first major project at my current job was to write a golang client for the Apache Kafka platform. Like wmem, a lot of it was pretty standard work (in this case implementing message formats and managing TCP connections). However, the design of the producer implementation was another one of these instances of theoretical fun. The requirements on a performant Kafka producer are complex and varied, balancing messages and batching across topics and partitions and brokers, while also maintaining message order in the face of partial failures and retries. I can’t tell you how many evenings I spent wandering around in a fog, stopping occasionally only to make tweaks to weird hypothetical flow diagrams on my whiteboard.

To a certain extent this project was less practical than the allocator; the reference java implementation was open-source and would have been fairly straight-forward to copy, but I did it myself for two main reasons:

  • I was working in Go, which provided me with very different concurrency primitives and indicated a very different design.
  • I was young, and not as aggressively pragmatic at the time.

To a certain extent it was also less successful; it has continued to evolve over the last four years and there are still parts of the design that I’m not entirely happy with. That said, it’s also far and away the most complex single algorithm I’ve ever built, and judging by Sarama’s popularity, it’s doing its job just fine in practice. I even managed to get a conference talk out of it.

GraphQL Warden

https://github.com/rmosolgo/graphql-ruby/issues/1333

If you recall my recent post on what I’ve been working on recently for my “real” job, it won’t surprise you that my most recent project is tangentially related to that. This one hasn’t been built yet (and my own pragmatism means it may never get built) but even from a design perspective I had a lot of fun with the process here. I definitely got way too excited when I realized that I could represent the two halves of the process as symmetric reachability problems in a graph-theoretical isomorphism of the schema.

And just maybe, the next time I get a chance to spend some “me time” at work, I’ll write an actual implementation of it!

Reflecting and Rebalancing

It’s been an… “interesting” couple of months. Life has a tendency to happen whether you want it to or not. Over the last few days I’ve been backing up some old media (ancient home videos and the like) and also re-reading some of my past blog posts. This has obviously put me in a reflective, somewhat nostalgic frame of mind.

Over the last few weeks, I feel like I’ve been trying to recover my balance in a certain sense. After everything that happened, I feel like I lack self-trust, purpose, and psychological safety. It’s an odd state to be in, because it’s easy to forget until something triggers it, as simple as spending an evening in an unfamiliar hotel room with nothing to do.

I’m aware of the tendency to “rosy retrospection”, aka focusing on the positive aspects of the past. Even so, it seems like I was in a better place last summer than I am now. This is uncomfortable because I can’t necessarily pin down why. I have changed (as people tend to do), but for the first time in my life I’m not convinced that I like how I have changed.

I don’t know if it is possible to change back, or if that’s really the right metaphor anymore. This feels like something where you can only control how you move forward, not how you move back. While historically I’ve always known where I wanted to go, and my only problem was how to get there… now I lack sufficient confidence in myself to pick a direction.

Time to find my balance, and recover a little bit of who I was last year. Reading some of those old blog posts has helped. I need to make some promises to myself, and then keep them.

Spinning the Flywheel

If reality is a system, and trust is a battery, then life itself is a flywheel. Flywheels are very neat little systems; they’re basically just another kind of battery, but the mechanical underpinnings mean they end up being used in rather different situations than where we’d think of “normal” batteries. In particular, flywheels are often used for “smoothing”: taking a spiky energy source and producing a steadier, more consistent output. This is a great way to think about life.

Most people have good days and bad days, good weeks and bad weeks, sometimes even good months and bad months. Depending on how we’re eating, how we’re sleeping, what stressors exist in our work and personal life, and just personal fluke biochemistry, we can end up accomplishing a lot, or a little. Some days I’m raring to go and get a million things done. Some days I just sleep and watch Netflix. It’s important to strike a balance.

While balance is important, and you burn out if you go go go all day every day, it’s also true that there’s a lot of things I’d like to do, and never enough time to do them in. We are biological creatures, and while we can’t usually control in the moment whether we feel productive or lazy, we can control in the long run how often those feelings occur. The basic form of this is the same good advice that everybody gives and just as frequently ignores: eat healthy, sleep well, exercise your body regularly, etc. Just doing these simple things will make you a bit more energetic, tipping you over the line from “lazy” to “productive” every so often.

But this advice on its own doesn’t feel very flywheely, it’s just kind of common sense. The flywheel comes in when we take another step back and start deliberately investing in our own future energy levels. Let’s imagine a day where you’re really on fire: lots of energy, ready to take on the world. You could spend the entire day just killing that project you’ve been working on, and let’s be honest that would be a pretty good use of your time. But you could also take an hour or two at some point to spin the flywheel. Prepare and freeze some healthy meals, plan your schedule for the next week, or even do something as simple as picking your outfit for tomorrow.

These things may feel like an odd use of “productive” time, when you could be getting even more done on that awesome project. But what they give you is even more productive time in the future. Tomorrow, when you wake up and are only feeling mediocre, your life is already in order. You have something to wear that you’re happy with, something to eat that is tasty and healthy, and you already know where you need to be and when. On another mediocre day, just getting through all of those things would be enough to exhaust whatever energy you had. Instead, you can use that energy toward the important project and keep the ball rolling.

I’ve listed some easy, obvious examples of personal flywheels, but there are opportunities for them everywhere. Investing in your flywheel can even take the form of a more literal investment: proper budgeting can be incredibly useful and simplify a lot of future money-related decisions.

Just be careful to keep an eye on how fast your flywheel is going. On good days with your flywheel spinning, it’s very easy to over-commit your future time in an unsustainable way. If you’ve committed to so many projects that you’re constantly drawing down your flywheel faster than you replenish it then you’re at risk of burning out: that’s the day you’ve run out of prepared meals but just don’t have time to stock up again so you get McDonald’s instead. Suddenly you’ve got a million things to do, nothing left in your flywheel, and no time to spin it up again. Just one lazy day in that scenario, and your whole life flies apart.

We can’t return we can only look behind
From where we came
And go round and round and round
In the circle game

– Joni Mitchell