On Tue, 22 Jun 2010 18:56:30 +0100 Nicolas Oury <nicolas.o...@gmail.com> wrote:
> 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 Don't I recall someone saying that small numbers are the most common ones? *Especially* if you're doing things like vector arithmetic. > 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). Um, it helps avoid some GC by *not doing an allocation*. According to what Rich said, doing the allocation is the performance problem - at least in the internals of clojure. Personally, I believe what Rich wrote. Not only does he have more experience than anyone else with the insides of clojure, but this matches my experience with adding GO-FAST to LISP systems. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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