News for hackers. Stuff that matters.
Re:Boost:Unordered_flat_map by mkoubaa on Saturday November 19, 2022 @07:37PM (#33676742)
Sometimes I wonder why these nifty data structures that someone already implemented in c++ don't immediately (or even 5+ years later) have ports to other languages. Especially languages that are closer to the metal
Re:Boost:Unordered_flat_map by tialaramex on Saturday November 19, 2022 @08:03PM (#33676944)
What sort of languages are you thinking of which are "closer to the metal" than C++ but support the features you'd want for these structures ?

The closest I can think of is Rust, but it does have ports of such things. Rust's HashMap is a Swiss Table - Abseil's flash_hash_map but ported to Rust (via HashBrown), Haphazard is a Rust port of the Folly library's hazard pointers (which might some day be C++ 26 or C++ 29 Hazard Pointers)

Re:Boost:Unordered_flat_map by sgerenser on Saturday November 19, 2022 @08:52PM (#33677248)
perhaps mkoubba meant “closer to the metal” than the average programming language, like, say Swift or even C#, not “closer to the metal” than C++. Otherwise it the comment makes little sense, as I would not even consider Rust “closer to the metal” than C++. Maybe C or x86 Assembly?
Re:Boost:Unordered_flat_map by mkoubaa on Saturday November 19, 2022 @09:09PM (#33677366)
Yes precisely. Closer than the average
Re:Boost:Unordered_flat_map by uluyol on Saturday November 19, 2022 @11:51PM (#33678367)
There are different semantics for these data structures in different languages. These tend to exist for corner cases, but those corner cases constrain your design.

So you might not be able to replace the default Java hashmap with absl::flat_hash_map, but you can steal ideas and maybe do better in other ways where the C++ map would be constrained. However, doing that is work that someone has to pick up.

And releasing a (e.g.) Go library that breaks from the built in map semantics might not see much adoption in that community. C++ actually seems a bit unique in terms of how many widely used implementations there are of key data structures (e.g. strings, maps, trees, inline vectors). Not criticizing just making an observation.

Re:Boost:Unordered_flat_map by mkoubaa on Sunday November 20, 2022 @06:02PM (#33686471)
This is a really good point. C++ developers seem to be more opinionated than other communities about data structure semantics in my experience. Possibly because the language chose the wrong semantics for the original standard library, whereas other languages made more sensible choices
Re:Boost:Unordered_flat_map by aaronbee on Sunday November 20, 2022 @01:13AM (#33678770)
There are some folks working on porting SwissTable to Go: https://github.com/golang/go/issues/54766

What’s holding it back currently is coming up with a way to do incremental rehash, which Go’s current map provides.

Re:Boost:Unordered_flat_map by rurban on Monday November 21, 2022 @12:38AM (#33689203)
Since the swisstable is available in C++ and C, everybody can trivially use it.

I'm more concerned about missing security policies. Like collision counting.