Those are good answers and it is acceptable, but what ends up happening is that it creates objects. I just used a profiler and that operation inside of my code for a typical run is executed 1,500 million times. It makes up the lions share of self-time measurements. Each object needs construction, destruction and garbage collection even though internally it may be using a primitive type. I'm working with large data structures and doing a lot of math (mainly matrix math) and so this is where I am getting slaughtered in performance. As confirmed by Clojure Programming there is contagion afterwards where everything afterward touched by those numbers becomes BigInt.
I'm working on rethinking how I am doing the math so that it doesn't produce so many objects. I think that doing it in the order that the sane looking algebra is laid out makes for readable code but the object contagion is robbing my program of speed. Since a true production run will end up being a million million of these types of operations I need to reconsider how I am going to lay this out. A couple of ideas come to mind such as delaying the use of division or pre-calculating the range of division results since there would only be a few of them. It's really interesting looking at performance for something simple that is going to be called so many times. Thanks for the information so far. -- -- 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/groups/opt_out.