Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-19 Thread John Harrop
(def *dosync-counts* (atom {}) (defn avg-in [map key val] (let [[avg cnt] (get map key [0 0])] (assoc map key [(/ (+ (* avg cnt) val) (inc cnt)) (inc cnt)]))) (defmacro logged-dosync [& body] `(let [count# (atom 0)] (dosync (swap! count# inc) ~...@body) (swap! *dosy

Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-19 Thread Mark Volkmann
On Wed, Aug 19, 2009 at 11:03 AM, Rich Hickey wrote: > > While I appreciate that you are trying to understand the > implementation of the STM, understanding the semantics of the STM in > terms of its implementation is wrong-way-around. > > The semantics are simpler, and the implementation is subje

Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-19 Thread Rich Hickey
On Fri, Aug 14, 2009 at 8:53 PM, Mark Volkmann wrote: > > On Fri, Aug 14, 2009 at 4:17 PM, Mark Volkmann > wrote: >> On Thu, Aug 13, 2009 at 4:58 AM, Chas Emerick wrote: >>> I know that if you have a dosync call in some function executed by a thread, and then that function calls other f

Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-16 Thread Chas Emerick
On Aug 14, 2009, at 8:53 PM, Mark Volkmann wrote: > So it seems the biggest impact of the change can be summarized as > follows. In the past, once you successfully ensured a Ref, you knew > you could write to it later because no other thread could also ensure > it. Now you don't know that. You k

Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-14 Thread Mark Volkmann
On Fri, Aug 14, 2009 at 4:17 PM, Mark Volkmann wrote: > On Thu, Aug 13, 2009 at 4:58 AM, Chas Emerick wrote: >> >>> I know that if you have a dosync call in some function executed by a >>> thread, and then that function calls other functions (which might have >>> their own dosyncs, which get bundl

Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-14 Thread Mark Volkmann
On Thu, Aug 13, 2009 at 4:58 AM, Chas Emerick wrote: > >> I know that if you have a dosync call in some function executed by a >> thread, and then that function calls other functions (which might have >> their own dosyncs, which get bundled together with the original >> transaction), then everythi

Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-13 Thread Meikel Brandmeyer
Hi, On Aug 13, 11:58 am, Chas Emerick wrote: > That said, I would urge caution in circumstances like what you've   > described. Additionally, transactions should be kept small. IIRC, Rich recommended that before. If possible, don't do complicated calculations inside a transaction. Sincerely M

Re: Can dosync transaction result computation be parallelized over multiple threads?

2009-08-13 Thread Chas Emerick
> I know that if you have a dosync call in some function executed by a > thread, and then that function calls other functions (which might have > their own dosyncs, which get bundled together with the original > transaction), then everything is fine. It seems common that all of > that work would

Can dosync transaction result computation be parallelized over multiple threads?

2009-08-13 Thread Andy Fingerhut
I know that if you have a dosync call in some function executed by a thread, and then that function calls other functions (which might have their own dosyncs, which get bundled together with the original transaction), then everything is fine. It seems common that all of that work would be done se