Live data from Hacker News

Ask HN: What are some cool but obscure data structures you know about?

news.ycombinator.com

741–750 of 772 posts

Re: Ask HN: What are some cool but obscure data structures you know about?

#741

HAMT: Hash Array Mapped Trie. This data structure makes efficient immutable data possible. You can update a list of a million items, and keep a reference to the original list, by changing 3 or 4 references and some bytes. This should replace copy-on-write for scripting languages. I really want to see it in a JS spec soon. There are libraries that can do it, but they add translation penalties and extra steps. I’d comp…

That’s what Immutable.js used under the hood.

As a case study we evaluated the performance of this along with other languages that use immutable data structures (perf testing) for a recent production app we were building. After some evaluation we had the opinion that the penalty of using immutable HAMT's on the Node/JS platform is just too high, at least in its current lib form. Immutable structures are often somewhat slower, but the relative penalty of using a HAMT on the Node/JS platform vs a straight mutable structure was much higher than other languages. Floats for numbers, conversions back and forth implicitly, pop count intrinsic missing, conversions in and out, and other such overheads make the relative penalty of an immutable HAMT vs a mutable JS map much higher compared to other languages such as .NET or Java let alone C/Rust.

Given Node is mostly single threaded as well some of the advantages (not all!) of immutability diminish on that platform making the performance penalty harder to swallow, at least for my use case.

It of course may not matter to your case, but I find the benefits of these structures come from their quicker clone/copy time in many applications, snapshot like characteristics, easy large diff's, etc. For this to matter the collection has to be of a decent size where a linear copy/equals/etc is too slow to work for the use case. At that point speed starts to matter as the costs of random lookup start to grow/drift further away from a standard mutable map and for JS we deemed the penalty too high and decided on another backend platform amenable to writing generic data structures.

Re: Ask HN: What are some cool but obscure data structures you know about?

#742

Cache-Oblivious Data Structures: https://cs.au.dk/~gerth/MassiveData02/notes/demaine.pdf A vaguely related notion is that naive analysis of big-O complexity in typical CS texts ignores over the increasing latency/cost of data access as the data size grows. This can't be ignored, no matter how much we would like to hand-wave it away, because physics gets in the way. A way to think about it is that a CPU core is like a…

Does anyone actually use cache-oblivious data structure in practice? Not, like, "yes I know there's a cache I will write a datastructure for that", that's common, but specifically cache-oblivious data structures? People mention them a lot but I've never heard anyone say they actually used them.

Yes, LSM trees are specifically designed with this propery in mind.

Re: Ask HN: What are some cool but obscure data structures you know about?

#743
post #12

Finger trees allow you to do amazing things. In essence they let you build an index, or multiple indices, for your dataset and then store them in a single structure. When I go from Haskell back to imperative land I find myself greatly missing this ability. Sure I can make multiple hashmaps or trees or whatever but being able to stuff it all in one data structure is amazing. One structure I built with them that is muc…

If I'm not mistaken, Clojure's data structures are (or used to be) implemented using finger trees.

A variation on 32 wide Bagwell hashed tries last time I looked. Scala was too. Those are much more annoying to implement without garbage collection fwiw.

Re: Ask HN: What are some cool but obscure data structures you know about?

#744
I left this thread alone since it is a rabbithole but I was surprised how monotonous it ended up being. The datastructure I am quite interested in these days is 'concept lattices' and object-property (bi)graphs. Although I am less interested in the dynamic side atm and am more thinking about representation of data while being exchanged.

Re: Ask HN: What are some cool but obscure data structures you know about?

#746

How about the current DATE formats based on the EPOCH. Hell, they knew there was nothing to it, but some backstreet performances inspired my Y2K formative years where my normal, kind, religious mother became a hoarder that destroyed everything she touched. Why can Java still not do simple date processing when even M$$ nailed that formula generations ago? Not letting devs communicate cross platform without Linux level…

I think you managed too lose me about 3 times in there.. what point are you trying to make, and what do you think Linus should do?

I appreciate the comment. Is that supposed to matter to me? What is your purpose?

Re: Ask HN: What are some cool but obscure data structures you know about?

#747

Earlier quoted context omitted.

I think you managed too lose me about 3 times in there.. what point are you trying to make, and what do you think Linus should do?

I appreciate the comment. Is that supposed to matter to me? What is your purpose?

I think Linus should do what he did when surveillance by horrific regimes came up in interview. Did the NSA force you to introduce backdoors?

Re: Ask HN: What are some cool but obscure data structures you know about?

#748

Earlier quoted context omitted.

I think you managed too lose me about 3 times in there.. what point are you trying to make, and what do you think Linus should do?

I appreciate the comment. Is that supposed to matter to me? What is your purpose?

Also... I have daddy issues. You're lack of approval makes me want to support Donald Trump. JK... it'd be that easy to destroy your politics, though

Re: Ask HN: What are some cool but obscure data structures you know about?

#749

How about the current DATE formats based on the EPOCH. Hell, they knew there was nothing to it, but some backstreet performances inspired my Y2K formative years where my normal, kind, religious mother became a hoarder that destroyed everything she touched. Why can Java still not do simple date processing when even M$$ nailed that formula generations ago? Not letting devs communicate cross platform without Linux level…

I think you managed too lose me about 3 times in there.. what point are you trying to make, and what do you think Linus should do?

I've sought out an isolated community of intellectuals that I respect if I actually exist at all... Your -1 is cute... But perhaps engage someone less intelligent than you who is genuinely trying so others who believe that everything ultimately ends in a violent last stand... Perhaps engage me in a dead thread without your timing advance

Re: Ask HN: What are some cool but obscure data structures you know about?

#750

How about the current DATE formats based on the EPOCH. Hell, they knew there was nothing to it, but some backstreet performances inspired my Y2K formative years where my normal, kind, religious mother became a hoarder that destroyed everything she touched. Why can Java still not do simple date processing when even M$$ nailed that formula generations ago? Not letting devs communicate cross platform without Linux level…

I think you managed too lose me about 3 times in there.. what point are you trying to make, and what do you think Linus should do?

I think if there's an intelligence gap between a guy who needs a tailor made retreat that costs more than my entire earnings potential for my lifetime to learn... DON'T BE AN ASSHOLE... SOMEONE WHO DOESN'T CARE WILL PUNCH YOU... I think humanity needs new heroes
Post reply on HN