Re: [ClojureScript] Parallel data processing and CLJS

2015-02-10 Thread Marc Fawzi
Thank you Jamie It does seem to work in CLJS and have a very major effect (defn vrange [n] (loop [i 0 v []] (if (< i n) (recur (inc i) (conj v i)) v))) (defn vrange2 [n] (loop [i 0 v (transient [])] (if (< i n) (recur (inc i) (conj! v i)) (persistent! v (

Re: [ClojureScript] Parallel data processing and CLJS

2015-02-10 Thread Marc Fawzi
Wow, That *may be* super useful in places where "persistent data structures would allocate too many objects, especially in applications such as games that are sensitive to garbage collection" (googled around, and ingested) check this out http://theatticlight.net/posts/Conways-Game-of-Life-in-Clo

Re: [ClojureScript] Parallel data processing and CLJS

2015-02-10 Thread Jamie Orchard-Hays
Dunno how CLJS compares with CLJ WRT to this, but reading about how Clojure gains performance under the covers (and exposes these fns to use) is illuminating: http://clojure.org/transients Jamie On Feb 10, 2015, at 12:49 PM, Gary Trakhman wrote: > Yea, I think the general clojure advice has

Re: [ClojureScript] Parallel data processing and CLJS

2015-02-10 Thread Gary Trakhman
Yea, I think the general clojure advice has been to not early-optimize, much work has been done to make the immutable data structures as fast as possible, though I'm not sure where the CLJS ones are at perf-wise these days. If you ever reach a bottleneck in your app, it should be relatively easier

Re: [ClojureScript] Parallel data processing and CLJS

2015-02-10 Thread Marc Fawzi
Answering my question with potential blind spots: The time it takes to populate data into an immutable tree (say an interval tree data structure or whatever kind) and the cost of updates to that immutable structure may be higher than the cost of copying. So I'm leaning toward the belief that i

Re: [ClojureScript] Parallel data processing and CLJS

2015-02-09 Thread Marc Fawzi
by processes in my previous reply, I mean async data processing loops running concurrently, i.e. a function called via setImmediate that keeps calling itself, and where you can have multiple of those running concurrently and operating on the same data structure In JS world, we'd make copies of

Re: [ClojureScript] Parallel data processing and CLJS

2015-02-09 Thread Marc Fawzi
right, concurrent, omitting the web worker stuff which relies on messaging, I see improvements to code clarity and maintainability with core.async but I'm trying to find if CLJS' immutable data structures give it a performance advantage where normally expensive copying/cloning would be required fo

Re: [ClojureScript] Parallel data processing and CLJS

2015-02-09 Thread Gary Trakhman
Core.async on clojurescript gives a huge advantage for concurrent data processing, maybe not parallel. On Mon Feb 09 2015 at 3:01:16 PM Marc Fawzi wrote: > > Potentially naive question, but I thought I should get it out of the way :) > > Since in Javascript, there are no threads with shared memo

[ClojureScript] Parallel data processing and CLJS

2015-02-09 Thread Marc Fawzi
Potentially naive question, but I thought I should get it out of the way :) Since in Javascript, there are no threads with shared memory, is there any performance advantage to using CLJS (vs JS, or Immutable.js vs mutable data structures) when it comes to parallel data processing? If so, are there