r/programming • u/jms_nh • Mar 18 '16
New Concurrent Hash Maps for C++
http://preshing.com/20160201/new-concurrent-hash-maps-for-cpp/4
u/kirbyfan64sos Mar 18 '16
Nice! I couldn't find a C++ concurrent hashmap that didn't have 10k GB of dependencies (Boost, I'm looking at you), but this only has 2 (CMake and Turf), and the latter seems to not require Boost in most cases.
2
u/c0r3ntin Mar 19 '16
You may want to look at boost bcp, a tool to extract subsets of boost http://www.boost.org/doc/libs/1_60_0/tools/bcp/doc/html/index.html
2
u/kirbyfan64sos Mar 19 '16
Gah, I never knew about that. Thanks!
2
u/Plorkyeran Mar 19 '16
It's significantly less useful than you're probably hoping for. In recent versions they've done a good job of cutting down on false dependencies where a library unintentionally depended on five other libraries just for a single definition, but even just the core support libraries that almost all boost libs depend on are pretty sizeable.
1
Mar 19 '16
yep. Was using asio and datetime which are supposedly header only libraries but I needed to compile boost_system to use it but overall my experience with boost has been very good.
3
1
u/cdglove Mar 20 '16
Boost.Asio always needs to link to system for error code. It's a bummer. Standalone ASIO does not have this problem. Some other boost libraries try to link to system too unless you define BOOST_SYSTEM_NO_DEPRECATED. Aside from Asio, that's fixed most of the link issues I've had.
1
u/cdglove Mar 19 '16
To quantify this, for example just including boost::flat_map used to drag in 1400kb of code. Now it's 1/2 that.
To be clear too, most of that is core code so it's not like you add 1 meg for every include. We have about 20million lines of code and use a lot of boost and the total boost include size is around 5megs for some of our more gigantic cpp files.
0
Mar 18 '16
[deleted]
3
u/Spartan-S63 Mar 18 '16
Granted Boost is a little heavy in the installation side, it's a wonderful set of libraries. I've really only used Boost.Graph, Boost.Filesystem, and Boost.Program_options, it's still great and I'd reach for it in a heartbeat again (partly because it's already installed on my system).
I'm really happy to see things like Boost.Filesystem get incorporated into the STL with the C++17 standard.
4
u/kirbyfan64sos Mar 18 '16
That's a build system, not a dependency.
Yeah, I knew it's a build system, but the project page says that CMake is required, hence my referring to it as a dependency.
0
Mar 18 '16
[deleted]
1
u/WrongAndBeligerent Mar 19 '16
You should look at the simplest example on the site, it is pretty obvious that it does work.
0
Mar 20 '16
[deleted]
0
u/WrongAndBeligerent Mar 20 '16
Well I've implemented it and tested it, have you even tried it?
0
Mar 20 '16
[deleted]
1
u/WrongAndBeligerent Mar 20 '16
Sure, but we're talking about two different things.
The original comment said "using lock free containers is a study in why they don't work."
I'm not saying anyone should use what I've written, I'm saying that you can't say 'lock free containers don't work' when they are out there literally working right now.
4
u/dicroce Mar 18 '16
As a learning exercise I wrote a lock free single producer single consumer ring buffer. Relative to everything else in the lock free world, this container is about as simple as it gets.... The thought of using a more complex lock free container gives me the heeby jeebies when I consider the prospect of having to debug a problem in such a beast... OTOH, I suppose as long as your container has a fairly standard interface it should be possible to rip it out and put in something more conventional should the need arise.