Readme.md in parallel-0.5.19 vs Readme.md in parallel-0.5.20

- old
+ new

@@ -32,16 +32,40 @@ ### Threads - Speedup for blocking operations - Global data can be modified - No extra memory used +### ActiveRecord +Try either of those to get working parallel AR + +```Ruby +Parallel.each(User.all, :in_threads => 8) do |user| + ActiveRecord::Base.connection_pool.with_connection do + user.update_attribute(:some_attribute, some_value) + end +end + +Parallel.each(User.all, :in_processes => 8) do |user| + ActiveRecord::Base.connection.reconnect! + user.update_attribute(:some_attribute, some_value) +end +``` + Processes/Threads are workers, they grab the next piece of work when they finish +### Progress / ETA + +```Ruby +require 'progressbar' +progress = ProgressBar.new("test", 100) +Parallel.map(1..100, :finish => lambda { |i, item| progress.inc }) { sleep 1 } +progress.finish +``` + Tips ==== - - [ActiveRecord] `ActiveRecord::Base.connection.reconnect!` inside the parallel block prevents errors - [Benchmark/Test] Disable threading/forking with `:in_threads => 0` or `:in_processes => 0`, great to test performance or to debug parallel issues TODO ==== - JRuby / Windows support <-> possible ? @@ -62,9 +86,10 @@ - [Mikko Kokkonen](https://github.com/mikian) - [brian p o'rourke](https://github.com/bpo) - [Norio Sato] - [Neal Stewart](https://github.com/n-time) - [Jurriaan Pruis](http://github.com/jurriaan) + - [Rob Worley](http://github.com/robworley) [Michael Grosser](http://grosser.it)<br/> michael@grosser.it<br/> License: MIT<br/> [![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=grosser&url=https://github.com/grosser/parallel&title=parallel&language=en_GB&tags=github&category=software)