If this is going to be the main performance bottleneck in your application, I would probably do it in Java (possibly implementing relevant Clojure interfaces to make it easy to use from Clojure). Ultimately, this gives you more control over the memory representation and the ability to do certain optimisations that aren't (yet) possible in Clojure.
Whether the structure should be immutable or not is a different question (whether you do it in Java or Clojure). Immutable data structures can give you better performance in some situations for the following reasons: a) Better in concurrent situations (no need for locking...) b) Ability to save space via structural sharing c) The JVM does some very nice optimisations with final values Whether these benefits outweigh the other performance advantages of mutability (mainly from less path copying / GC pressure) will of course depend on your application and access pattern. On Friday, 27 June 2014 05:04:34 UTC+1, Vjeran Marcinko wrote: > > Hi, > > I am planning to play with implementing some giant in-memory index that is > basically tree-like structure containing counters on certain tree nodes, > and can aggregate billion data points and will probably consume tens of GBs > of RAM. > > Since space (memory)-efficiency is crucial here, I was wondering how good > Clojure is for this problem, and should I better just stick to plain java, > because it is well known that clojure's persistent data structures > sacrifice space (and some speed, but that is not such a big issue here) for > sake of immutability and good development practice? > > Regards, > Vjeran > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.