Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The key idea behind Clojure data structures is that they are immutable, but don't require a full copy on update, because an updated version partly reuses the initial version. The data structure that enables this is called HAMT (hash array mapped trie). Clojure's implementation modified the initial Phil Bagwell's implementation of HAMT in a subtle way in order to make performance characteristics not degrade over time.


Interesting, it makes more sense now. Though I'm not clear if you want/need that in a video game. In general you want two data structures, one current state of the world and one next state - since they have a lot of similarity it at first makes sense to do what you say, except the you lose the advantage of vector: it is very cache friendly to iterate on a vector, or even two vectors, while it appears (without knowing internal details) that your HAMT is less cache friendly as the next element is not in the next memory location.

Of course I'd need benchmarks to make a real judgement. The above is my gut reaction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: