(time (let [arr (make-array Float/TYPE 1 1)] (dotimes [_ 100000] (let [#^floats sub-arr (aget arr 0)] (aset-float sub-arr 0 0.0)))))
Seems to work? Looks an eligible candidate for a macro. On Mon, Feb 23, 2009 at 9:04 PM, Jason Wolfe <jawo...@berkeley.edu> wrote: > > I'm trying to call some third-party code that expects a two- > dimensional double array, and I can't figure out how to create and > fill this in Clojure without a huge perf hit (which profiling shows to > be coming from reflection): > > user> (time (let [arr (make-array Double/TYPE 1)] (dotimes [_ 100000] > (aset-double arr 0 0.0)))) > "Elapsed time: 28.408 msecs" > nil > > user> (time (let [arr (make-array Double/TYPE 1 1)] (dotimes [_ > 100000] (aset-double arr 0 0 0.0)))) > "Elapsed time: 3634.136 msecs" > nil > > I've tried adding type hints like #^"[[D" to no avail. What am I > missing here? > > BTW, I'm still on the pre-lazy SVN, waiting for the dust to settle. > > Thanks, > Jason > > > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---