On 16 September 2013 09:03, Mikera <mike.r.anderson...@gmail.com> wrote:
> > Obviously this is just a microbenchmark, but it fits my general experience > that floats are a reasonable bit faster than doubles, typically 20-100% > (doubles are closer when it is pure number crunching since 64-bit CPUs are > actually pretty good at doubles, floats have a bigger advantage when you > are manipulating a lot of data points and hence memory bandwidth matters > more) > > Code here for those interested: > src/test/java/mikera/vectorz/performance/FloatVsDoubleBenchmark.java > That's a pretty interesting result. I ran some tests of my own, based on your code, as I wondered whether or not the time to instantiate the array of doubles was biasing the test. My goal was to see whether or not I'd get a similar result running an array of floats through a method that processed doubles. (See: https://gist.github.com/weavejester/6583367) It turns out that I get a similar result. Passing floats to a method that takes doubles slows things down by a similar amount, unless I've somehow botched up the test. Considering that converting between single and double precision should be pretty cheap on the CPU, I'm surprised at the difference. This somewhat changes my view on things. It doesn't affect me in practice, but I can see how someone might be frustrated by having to drop down to Java to achieve performance for floating point calculations. - James -- -- 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.