3 ms·
You don't ever need a concurrent linked list or hash map? Lock-free concurrent data structures always struck me as the killer use case for generics as far as d
by pcwalton 11y ago
You don't ever need a concurrent linked list or hash map?
Lock-free concurrent data structures always struck me as the killer use case for generics as far as data structures are concerned: reasoning about atomics (especially when you have to annotate with relaxed/acquire/release/sequentially consistent ordering) is really tricky and one small mistake will lead to incredibly difficult-to-reproduce bugs. You really don't want to rewrite those over and over. Even something like a j.u.c-style concurrent hash map with striped locking needs careful thought around growth and reallocation lest you deadlock; it's so much easier to just have someone else write the data structure.
- threeseed 11y agoWriting bug free data structure implementations is hard. Doing it in a way that is highly performant is extremely hard. The idea of cutting/pasting code seems pretty backwards to me compared to just using one of these libraries: http://java-performance.info/large-hashmap-overview-jdk-fastutil-goldman-sachs-hppc-koloboke-trove http://java-performance.info/large-hashmap-overview-jdk-fast...
- lolhackernews 11y agoThing is, in Go that library cannot be written generically.