I’ve been using Go since Go 1.4. Since I started using Go then (2014-2015 ish), I’ve seen the language evolve significantly. The Go I write today is roughly the same Go as the Go I wrote back when I was still learning the language, but the toolchain has changed in ways that make it so much nicer in practice. Here are the biggest things that changed how I use Go on a regular basis:

  • The compiler rewrite in Go

  • Go modules

  • The context package

  • Generics

This is a good thing. Go has had a lot of people use it. My career would not exist in its current form without Go. My time in the Go community has been catalytic to my career goals and it’s made me into the professional I am today. Without having met the people I did in the Go slack, I would probably not have gotten as lucky as I have as consistently as I have.

Read More

Earlier this month Ted Unangst researched compiling the OpenBSD kernel 50% faster, which involved stubbing out the largest, extraneous branches of the source tree. To find the lowest-hanging fruit, he wrote a tool called watcwhere’s all the code — that displays an interactive “usage” summary of a source tree oriented around line count. A followup post about exploring the tree in parallel got me thinking about the problem, especially since I had just written about a concurrent queue. Turning it over in my mind, I saw opportunities for interesting data structures and memory management, and so I wanted to write my own version of the tool, watc.c, which is the subject of this article.

Read More

The LoB principle is a simple prescriptive formulation of the quoted statement from Richard Gabriel. In as much as it is possible, and in balance with other concerns, developers should strive to make the behaviour of a code element obvious on inspection.

There’s a feeling in the air. A zeitgeist. SPAs are no longer the cool kids they once were 10 years ago.

Hip new frameworks like Astro, Qwik, and Elder.js are touting their MPA capabilities with “0kB JavaScript by default.” Blog posts are making the rounds listing all the challenges with SPAs: history, focus management, scroll restoration, Cmd/Ctrl-click, memory leaks, etc. Gleeful potshots are being taken against SPAs.

Not everything at a big company involves writing code. Sometimes, you have to do a bunch of meta stuff in order to manage the projects. These are two stories of doing exactly that.

One of my favorite features of the Cosmopolitan Libc runtime is its –ftrace flag that logs C function calls. It’s the simplest system for debugging programs I’ve ever used and it surprises me that I found no evidence of someone having invented it before.

Here’s one of its most important use cases. Have you ever had you debugger stupified by a NULL function pointer before? Debuggers aren’t very good at handling this situation. Because once the control flow jumps to the NULL page, you’d need to find a way to rewind execution history to figure out how it got there. But if you have function call logging, you can just look backwards in the log, see what was happening before, and get a pretty good idea.

Read More

Since I was unable to travel for a couple of years during the pandemic, I decided to take my new-found time and really lean into Rust. After writing over 100k lines of Rust code, I think I am starting to get a feel for the language and like every cranky engineer I have developed opinions and because this is the Internet I’m going to share them.

The pitch went like:

  1. JS & the browser are slow

  2. Incrementally porting JS to Rust/Wasm will speed up your app

  3. We’ll land-and-expand from small ports to take over your whole app

  4. In the long-run this evolves to a next-gen stack (”Unity for apps”)

We uncovered holes in this story once we started working with our pilot users. We always knew that it would always be possible to speed up slow JS within JS. No Rust/Wasm required. Our bet was that it would be 10x more ergonomic to speed up your app, incrementally, in Rust. This did not hold up in real-world implementations.

Read More

Andrew Gallant’s ripgrep introduction post showed us that classic Unix tools like grep (and its later iterations like ag) can be dramatically improved in the areas of raw performance, user-experience, and correctness. These modern Unix tools (like ripgrep, bat, jq, exa, or fd) aren’t quite drop-in replacements but they’re close enough to avoid paper cuts, and for most use cases are better than the originals in a programmer’s daily workflow.

Gallant’s treatise on file searching, and the benchmarks and analysis, got me excited about searching, and the conclusion of his post rings true:

String searching is an old problem in computer science, but there is still plenty of work left to do to advance the state of the art.

I set out to beat macOS Monterey’s default grep (2.6.0-FreeBSD) in a microbenchmark that represents my daily file searching. I chose Go because I like writing Go programs.

The tool I built for this post is called grup and lives inside my terminal tools monorepo which is a project to take ownership over the commands I run every day.

Read More

LSP (language server protocol) is fairly popular today. There’s a standard explanation of why that is the case. You probably have seen this picture before:

I believe that this standard explanation of LSP popularity is wrong. In this post, I suggest an alternative picture.

Features for C# 11 are coming along nicely! You can check these features out by downloading Visual Studio 17.2 Preview 3 or .NET 7 Preview 3 for other editors. You can find more about C# 11 features that appeared earlier in What’s new in C# 11 and Early peek at C# 11 features and you can follow the progress of C# 11 on the Feature Status page. You can find out about other .NET 7 Preview 3 features in this .NET Blog post and more about Visual Studio 17.2 in the release notes.

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user’s browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

Read More

The nlohmann/json library is everything a developer can expect from a modern library — easy to integrate and JSON objects are treated as first class citizens with a very intuitive API.

However, it has one problem that is widely mentioned across the internet, which I’ll tell you about below. Various solutions to the problem have been developed and shared, but none seem to be easy-to-use.

In this blog post, we will see how one can serialize and deserialize almost anything by extending the library a bit.

Read More

A long time ago at one of my first software jobs, I received a bug report for a internal product that I didn’t even know existed.

It turned out to be an application that serves up basically every form that any employee within the company might need. Essentially a catch-all resource. Do you need to report someone to HR? There is a form for that. Do you need a contract for a new client? There is a form for that.

The responsibility of maintaining the project had been bounced from team to team over the years. Apparently it belonged to my team. And by my team, I mean me.

Oh, the horror.

It was a single code file with over 11,000 lines of VBScript.

Read More

ACM, the Association for Computing Machinery, today named Jack J. Dongarra recipient of the 2021 ACM A.M. Turing Award for pioneering contributions to numerical algorithms and libraries that enabled high performance computational software to keep pace with exponential hardware improvements for over four decades. Dongarra is a University Distinguished Professor of Computer Science in the Electrical Engineering and Computer Science Department at the University of Tennessee. He also holds appointments with Oak Ridge National Laboratory and the University of Manchester.

Read More