On Tue, Jun 22, 2010 at 6:43 PM, Mike Meyer < mwm-keyword-googlegroups.620...@mired.org> wrote:
> > > Everyone has to realize the math you are advocating for the default, > > on non-tagged architectures like the JVM and CLR, *must* do an > > allocation on every +/-/* etc operation. And such ops are littered > > throughout non-numeric data structure code, for indexes, offsets, > > bounds etc. Allocating on every math op in something like the > > persistent vector would make it completely unusably slow. > > I disagree with that first statement, and will point to python as the > counterexample. Like Clojure, it has immutable integers. It avoids the > issue of having to allocate for those ops some of the time by keeping > a table of the first N (tunable at interpreter build time) integers > that *all* instances of small integers point to. So 5 + 5 doesn't > allocate a new object, it returns a pointer to the pre-allocated 10 in > that table. The JVM can do that for you, if you want. It may have issues with concurrency though, depending of the way it is implemented. However, it does not solve the problem of performance of boxed nums, though. 1. It is only helps for small numbers 2.It only help GC. And GC is not the main issue, imho. (pointer dereference, including cache misses, and filling the cache with garbage is more annoying than GCs, imho. But I am not an expert). -- 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