How costly is changing the hardware rounding mode?
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.
New Web Domain & Mastodon Handle
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.
Using Fibonacci Hashing in hashmap.h
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.
Making Hashing Faster in hashmap.h
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!
New Year Cleanup
As a new year starts I generally have some long awaited cleanup to do on my C/C++ single header libraries. Maybe I need to update the CI scripts because they are out of date, maybe I have some features I want to add, or maybe I want to test more things. For those that do not know I have six main libraries that I maintain that are single header and work across C/C++: