this post was submitted on 14 Aug 2024
11 points (100.0% liked)

C++

1805 readers
2 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS
 

I had some fun trying to check if a hash (more like a transformation really) was collision free, so I wrote a quick piece code and then iterated on it so that it was usable.

I might add a quick bench and graphs and try to push it even further just for fun, to explore std::future a bit more (though the shared bit set might be a problem unless you put a shared condition variable on it to allow concurrent read but block concurrent writes?)

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 4 months ago* (last edited 4 months ago) (2 children)

I like the problem solving description, I actually went through a similar learning process leading to bitset recently. It was very satisfying!

However, I just have to ask a question: What is the reason you didn't just use UUID?

[–] SuperFola 2 points 4 months ago (1 children)

Thanks!

It would have been a lot easier to generate a fresh UUID for every record, but that means storing it. And we would have a unique sequential id alongside a unique UUID, two different keys for the exact same data. It is doable, afterall it's just an additional 128bits for every record, but for the sake of it I wanted to not store an additional ID and be able to compute the UUID on the fly from the base sequential ID.

[–] [email protected] 1 points 4 months ago

Ah, I didn't think about this. Thanks for the explanation!