I keep getting lucky with the PR numbers
I keep getting lucky with the PR numbers
Nested match statements, as the Lord intended
I like this thought process.
Easier to think of a database = storage layer + data model + query layer (language + optimizer)
Seems like itβs all in preparation for an IPO
Its issues like this that make me thankful I finally jumped to having a dedicated Ubuntu box. Open source tools actually *just work*
My toy database coming along quite nicely
Me trying to write code quickly in Rust
Really, really liking Rust's iterator pattern the more I use it!
Makes composition so much nicer to look at and reason about
In the year of our lord 2025, this is not a heretical opinion solely because of the abysmal state of debugging tooling in Rust z
The more Rust I write, the more I vibe with this meme
Kolkata got some banging food
It has been 0 days since I've been bitten by Rust lifetimes
Iβm fairly certain Amazon also does an LLM chatbot thing where itβs pretending to be a person on chat.
The formulaic responses give it away.
Isnβt this the exact same drama that happened with Ted Tsoβo?
The biggest drawback of any form of writing generated by LLM's is that it just doesn't feel very honest. The vibes are off
Functional programming got jokes
If you found this interesting, give the full article a read which goes into much more depth and contains links to more interesting tidbits around Rust compiler optimizations
redixhumayun.github.io/performance/...
Now, we see much better performance when comparing cache stats for the 3 implementations.
It isn't enough to have contiguous memory access, you also need to be aware of the cache hardware and how many entries can fit per cache line.
Doing all of the above requires you to know some information about your hardware, like the size of your cache and the size of a cache line.
We can do a more compact open addressing scheme which will fit 4 entries per cache line
Also, using u64 instead of Strings leads to better performance since Strings are always heap allocated
The problem is the memory layout of the structs used for chaining and open addressing
With chaining, we only have pointers which are 8 bytes each so that's 8 per cache line in a 64 byte cache line
With open addressing, it's 24 bytes each so that's 2 per cache line with padding
Profiling, however, shows very different results. It shows chaining and open addressing displaying roughly the same levels of cache performance.
Open addressing ends up performing better but that's only due to fewer overall instructions
You can handle collisions via open addressing (linear probing). This is where you just search through every subsequent entry until you find one where you can insert the key-value pair.
This should be more cache friendly since the entire memory is contiguously allocated
You can handle collisions via chaining where each entry becomes a linked list. This is simple but tends to lead to fragmented memory since each node is allocated separately.
Fragmented memory should theoretically lead to poorer cache performance.
Building a hash map is easy enough - a few public methods and a couple of internal methods to track when to resize the hash map
My only real recommendation from the post is to not bother profiling on OSX! It's a locked down nightmare of an OS
I've covered all the steps required to get Linux up and running for profiling here: github.com/redixhumayun...
Apple requires jumping through too many hoops
Here's a link to the full post
redixhumayun.github.io/performance/...
I've been trying to understand profiling tools better and decided to build a cache conscious hash map as a way to get more familiar with the tooling.
I wrote a small blog post and I'll cover the high level points in this π§΅
The database is the log
Although, this does beg the question of how to ensure Strings perform well with caches. Possibly they can't?