Quantcast
Channel: Probably Dance
Browsing latest articles
Browse All 15 View Live

Fine-grained Locking with Two-Bit Mutexes

Lets say you want to have a mutex for every item in a list with 10k elements. It feels a bit wasteful to use a std::mutex for each of those elements. In Linux std::mutex is 40 bytes, in Windows it’s...

View Article


Image may be NSFW.
Clik here to view.

Beautiful Branchless Binary Search

I read a blog post by Alex Muscar, “Beautiful Binary Search in D“. It describes a binary search called “Shar’s algorithm”. I’d never heard of it and it’s impossible to google, but looking at the...

View Article


Two Kids Put Me on a Two Sleep Schedule

I’m writing this at 2am, having already slept from 9pm to 1am. I will sleep again from 4am to 7am. This is apparently called “biphasic sleep”, which I first heard about in the 2022 article The...

View Article

Image may be NSFW.
Clik here to view.

Transform Matrices are Great and You Should Understand Them

The title of this blog post is obvious for any game programmer, but I notice that people outside of games often write clumsy code because they don’t know how transform matrices work. Especially when...

View Article

How I use LLMs to program

Studies have shown that LLMs help novice programmers more than experienced programmers. This matches my experience. At work I see that interns or new hires have some LLM window open almost all the...

View Article


Image may be NSFW.
Clik here to view.

Initial CUDA Performance Surprises

I am somehow very late to learning CUDA. I didn’t even know until recently that CUDA is just C++ with a small amount of extra stuff. If I had known that there is so little friction to learning it, I...

View Article

Image may be NSFW.
Clik here to view.

Why Does Integer Addition Approximate Float Multiplication?

Here is a rough approximation of float multiplication (source): float rough_float_multiply(float a, float b) { constexpr uint32_t bias = 0x3f76d000; return...

View Article

Image may be NSFW.
Clik here to view.

I’m Open-Sourcing my Custom Benchmark GUI

I think one of the reasons why I was able to do good performance work over the years is that at some point I started taking benchmarking seriously enough to write my own library. I used to use Google...

View Article


Image may be NSFW.
Clik here to view.

Revisiting Knuth’s “Premature Optimization” Paper

The most famous quote from Knuth’s paper “Structured Programming with go to Statements” is this: There is no doubt that the grail of efficiency leads to abuse. Programmers waste enormous amounts of...

View Article


Image may be NSFW.
Clik here to view.

Installing a Mini-Split AC in a Brooklyn Apartment

Last year, 2024, we replaced four PTACs with a mini-split AC. I’ve been asked about it often enough (by neighbors, coworkers, friends) that I decided to write up the experience. Hopefully it’s useful...

View Article
Browsing latest articles
Browse All 15 View Live