On Mon, Nov 16, 2009 at 5:27 PM, Charles Oliver Nutter
<[email protected]> wrote:

> * Dynamic languages on the JVM have to use boxed numerics most of the
> time, which means that we're creating a lot of numeric objects. Some
> of these may be nearly free, immediately-collectable. Some may be
> eliminated by escape analysis in future versions of the JVM (e.g.
> current JDK 7, which has EA on by default). But even with the best
> tricks and best GC, the use of objects for numerics is still going to
> be slower (on average) than primitives. How to cope with this?

In the end the answer will be fixnums.  As things stand, Integers are
so slow that BigIntegers aren't much slower: consequently, I decided,
since I needed unlimited size integers, to use BigIntegers
exclusively.  This eliminated a lot of annoying conversions, which now
happen only when talking to Java methods.

> * JVM languages that use closures are forced to heap-allocate
> structures in which to hold closed-over values. That means every
> instantiation of those closures allocates purely-transient objects,
> populates them with data, and passes them down-stack for other code
> bodies to use.

The key in this case is, I think, to create flat closures that contain
only the necessary variables, after boxing all assigned-to variables
so that you can copy the box pointers.

> Another wrinkle is the use of immutable structures, as in Clojure. I'm
> curious whether such systems generate more garbage than those that
> permit the use of in-place-mutable structures (seems to me that they
> would) and how that plays into memory bandwidth, allocation and GC
> rates, and whether the bulk of the extra garbage is young or gets
> tenured in typical usage.

My guess would be that most people only care about the most recent
state, which means that older states become young garbage.

-- 
GMail doesn't have rotating .sigs, but you can see mine at
http://www.ccil.org/~cowan/signatures

--

You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=.


Reply via email to