The Return to Office episode of one of my favourite podcasts Dithering made me finally decide to post about Remote Work. I’ll be back to my irregular coding posts soon, but I wanted to get this off my chest. Let me get all the caveats out the way - I worked in an office full time for the first five years of my career, and have now been working remotely for nine years.
I was looking at hardware rounding modes the other day, and one thing that I realised I had no concept of was how costly is it to change the hardware rounding mode for floating-point operations. For those that don’t know - modern hardware often includes a way to set the rounding mode that floating-point operations use when there is an imprecision in the result of a floating-point operation that cannot be encoded in the format.
This all started when I wondered what the Mastodon migration process between accounts was like, and ended with me moving my mastodon over to a new handle @email@example.com, and my website over to a new domain https://www.neilhenning.dev/. I remember maybe two or three years into Twitter trying to change my handle over to be my name, and it was already taken. It always irked me that I couldn’t just use my name, but it wasn’t to be.
I’ve been noodling a lot with my single header C/C++ hashmap recently - hashmap.h. I knew from reading around that the power-of-two size requirement I had meant that it made getting a bucket location in the range was easy, but that it could result in suboptimal bucket selection. Various places on the interwebs said that using a prime number hash was better as doing the modulus by a prime would give a much better avalanche effect, but this would come at the cost of having to do an actual integer modulus operation for every hash - which is quite a bit slower.
One of the C/C++ single header libraries I maintain is hashmap.h. This library is a super light weight and easily integrated hashmap - I’m not focused on the performance necessarily here, it’s really there primarily as a nice-to-use hashmap for when you just want to throw something in there. But that doesn’t mean I want the performance to suck either. If I can make it faster without compromising the API, I’m totally gonna do that!