On Tuesday, 3 June 2014 23:32:18 UTC+3, Andreas Arnold wrote: > Thanks David! > > I tried it today with `aset` and more 'basic' JavaScript and got it down to > 50ms. > > > > > On Mon, Jun 2, 2014 at 4:43 PM, David Nolen <[email protected]> wrote: > > > If eeking out every last bit of performance is your #1 concern, then no you > should not use ClojureScript functional operations over primitive arrays. > loop/recur, aget, aset and standard Array methods are your friends. > > > > > David > > > > > On Mon, Jun 2, 2014 at 9:52 AM, Andreas Arnold <[email protected]> wrote: > > > > > You mean with `#js`? For example (def thing-one #js [1 2 3])? That way I > can't use any ClojureScript methods like `map`, right? > > > > A example might help to really figure out what I am trying to do here. I have > code like the following: > > > > (defn build-tile-vertices [x-coord y-coord] > > (let [tile-template [[0 0 0] > > [1 0 0] > > [1 1 0] > > [0 1 0]] > > translate (fn [[x y z]] [(+ x x-coord) (+ y y-coord) z])] > > (mapcat translate tile-template))) > > > > Would there be a way to keep all of this directly as a JavaScript array? Or > did you mean I should fall back to bare JavaScript? Or is there something > totally different that I am missing? > > > > > > > -- > > Note that posts from new members are moderated - please be patient with your > first post. > > --- > > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > > > To post to this group, send email to [email protected]. > > Visit this group at http://groups.google.com/group/clojurescript. > > > > > > > > > > -- > > Note that posts from new members are moderated - please be patient with your > first post. > > --- > > You received this message because you are subscribed to a topic in the Google > Groups "ClojureScript" group. > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojurescript/Z2pFr_qy79w/unsubscribe. > > To unsubscribe from this group and all its topics, send an email to > [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at http://groups.google.com/group/clojurescript.
You can also use amap and reduce to keep the functional spirit alive. http://clojuredocs.org/clojure_core/clojure.core/amap http://clojuredocs.org/clojure_core/clojure.core/areduce -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
