What about memoizing (clojure.core/memoize) the function that creates the
leaves?

- James


On 29 March 2014 11:36, <vte...@gmail.com> wrote:

> Hi all,
>
> maybe someone here can point me to the right direction. I have a large
> lookup tree (millions of entries), but the values in the leafs don't
> contain much information. That is, the number of unique values stored in
> leafs is rather small, same values are used over and over again. I load the
> tree from DB and create leaf values one by one as vectors. Clojure creates
> every time a new vector instance (e.g (= (java.lang.System/identityHashCode
> [1 2]) (java.lang.System/identityHashCode [1 2])) evaluates always to
> false) although most of the time there is no need for that because I
> already have it somewhere and could just reuse previous instance. I
> implemented that optimization manually and it works. The memory consumption
> dropped 20 times. My question is, that is there any way Clojure can do this
> optimization automatically (like Java handles strings for example)? Or are
> there any libraries, that can help to do that?
>
> Thank you in advance,
>
> --
> 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.
>

-- 
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.

Reply via email to