I have a useful library for image manipulation in Clojure, you may find it useful:
https://github.com/mikera/imagez New ideas / PRs gratefully received! On Sunday, 13 March 2016 04:14:34 UTC+8, James Elliott wrote: > > Interesting! This is the first time I have had to drop out of Clojure for > performance reasons. It is not too surprising, given that I am doing > low-level byte bashing in a tight loop to send pixels to a display over USB > at sixty frames per second. But it is surprising that nothing like this has > happened before in building my Clojure environment for running light shows. > > I have created a separate Java library which I am calling Wayang, to make > it easy for any Java project to drive this display. Once that’s done, I may > add a small Clojure convenience wrapper, or I may just have Afterglow use > Wayang directly. https://github.com/brunchboy/wayang > > But first I have a bunch of Java2D integration to implement! > > On Thursday, March 13, 2014 at 12:26:33 AM UTC-5, Ignacio Corderi wrote: >> >> Hey guys, here is a huge performance problem I'm trying to figure out: >> >> ;; Say you have 2 data arrays sitting out there of 1 MB >> >> (def one-mb (byte-array (* 1024 1024))) >> (def another-mb (byte-array (* 1024 1024))) >> >> ;; and another one that should have the byte-by-byte XOR of the previous >> two >> >> (def out-mb (byte-array (* 1024 1024))) >> >> ;; question is... how do you code this guy, so that it doesn't take >> forever >> >> (defn inplace-xor [a b out] >> (def ln (count a)) >> (loop [x 0] >> (if (< x ln) >> (do >> (aset-byte out x (bit-xor (nth a x) (nth b x))) >> (recur (+ x 1)) >> )))) >> >> ;; checking the time >> >> (time (inplace-xor one-mb another-mb out-mb)) >> >> ;; takes about ~400ms which is.... well... A LOT >> >> ;; I'm happy to receive a solution that involves calling some java >> library... >> >> Thanks in advance! >> -Ignacio >> >> >> > -- 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/d/optout.