cej38 <junkerme...@gmail.com> writes:

>    I have watched, listened-to, or read most of the stuff out there that
>    is on how to tune your code to be faster (ie. type-hints).  All of
>    these pointers are great.  It is useful to know.  What I haven't seen
>    is something similar about best practices for how to make your code use
>    as little memory as possible.  This is something that I run up against
>    all of the time.  I am sure that there are tips out there to be had,
>    but I haven't really seen anything.

You are using the JVM, so this is liking trying to minimize the rattling
of your coat buttons while driving a train.

You want to limit the amount of data you hold in memory, of course, and
that often means using streams, and orienting your work towards that.
For example, instead of loading an entire document up, modifying it in
mem, and then kicking it out a pipe, you would structure your
modifications such that it could work on a stream.

You also want to minimize intermediate forms of your data.  For example,
we recently switched from Enlive to JSoup, beause we could then avoid
the cost of converting the source documents into the clojure data
structure Enlive used.  JSoup provides a sufficient API on it's java
objects for use to do our work in this case.





-- 
Craig Brozefsky <cr...@red-bean.com>
Premature reification is the root of all evil

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

Reply via email to