parallel 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,2 @@
1
+ before_script:
2
+ - export TRAVIS=1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parallel (0.6.4)
4
+ parallel (0.6.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Readme.md CHANGED
@@ -3,25 +3,35 @@ Best suited for map-reduce or e.g. parallel downloads/uploads.
3
3
 
4
4
  Install
5
5
  =======
6
- sudo gem install parallel
6
+
7
+ ```Bash
8
+ gem install parallel
9
+ ```
7
10
 
8
11
  Usage
9
12
  =====
10
- # 2 CPUs -> work in 2 processes (a,b + c)
11
- results = Parallel.map(['a','b','c']) do |one_letter|
12
- expensive_calculation(one_letter)
13
- end
14
13
 
15
- # 3 Processes -> finished after 1 run
16
- results = Parallel.map(['a','b','c'], :in_processes=>3){|one_letter| ... }
14
+ ```Ruby
15
+ # 2 CPUs -> work in 2 processes (a,b + c)
16
+ results = Parallel.map(['a','b','c']) do |one_letter|
17
+ expensive_calculation(one_letter)
18
+ end
19
+
20
+ # 3 Processes -> finished after 1 run
21
+ results = Parallel.map(['a','b','c'], :in_processes=>3){|one_letter| ... }
17
22
 
18
- # 3 Threads -> finished after 1 run
19
- results = Parallel.map(['a','b','c'], :in_threads=>3){|one_letter| ... }
23
+ # 3 Threads -> finished after 1 run
24
+ results = Parallel.map(['a','b','c'], :in_threads=>3){|one_letter| ... }
25
+ ```
20
26
 
21
27
  Same can be done with `each`
22
- Parallel.each(['a','b','c']){|one_letter| ... }
28
+ ```Ruby
29
+ Parallel.each(['a','b','c']){|one_letter| ... }
30
+ ```
23
31
  or `each_with_index` or `map_with_index`
24
32
 
33
+ Processes/Threads are workers, they grab the next piece of work when they finish.
34
+
25
35
  ### Processes
26
36
  - Speedup through multiple CPUs
27
37
  - Speedup for blocking operations
@@ -59,15 +69,16 @@ Parallel.map(User.all) do |user|
59
69
  end
60
70
  ```
61
71
 
62
- Processes/Threads are workers, they grab the next piece of work when they finish
63
-
64
72
  ### Progress / ETA
65
73
 
74
+ ```Bash
75
+ gem install ruby-progressbar
76
+ ```
77
+
66
78
  ```Ruby
67
- require 'progressbar'
68
- progress = ProgressBar.new("test", 100)
69
- Parallel.map(1..100, :finish => lambda { |i, item| progress.inc }) { sleep 1 }
70
- progress.finish
79
+ require 'ruby-progressbar'
80
+ progress = ProgressBar.create(:title => "The Progress", :total => 100)
81
+ Parallel.map(1..100, :finish => lambda { |i, item| progress.increment }) { sleep 1 }
71
82
  ```
72
83
 
73
84
  Tips
@@ -103,4 +114,4 @@ Authors
103
114
  [Michael Grosser](http://grosser.it)<br/>
104
115
  michael@grosser.it<br/>
105
116
  License: MIT<br/>
106
- [![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)
117
+ [![Build Status](https://travis-ci.org/grosser/parallel.png)](https://travis-ci.org/grosser/parallel)
@@ -118,7 +118,7 @@ module Parallel
118
118
  when /darwin/
119
119
  (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
120
120
  when /linux|cygwin/
121
- `grep -c processor /proc/cpuinfo`.to_i
121
+ `grep -c ^processor /proc/cpuinfo`.to_i
122
122
  when /(open|free)bsd/
123
123
  `sysctl -n hw.ncpu`.to_i
124
124
  when /mswin|mingw/
@@ -1,3 +1,3 @@
1
1
  module Parallel
2
- VERSION = Version = '0.6.4'
2
+ VERSION = Version = '0.6.5'
3
3
  end
@@ -30,6 +30,7 @@ describe Parallel do
30
30
  end
31
31
 
32
32
  it "is half or same as normal cpu" do
33
+ pending if ENV["TRAVIS"]
33
34
  [Parallel.processor_count, Parallel.processor_count / 2].should include Parallel.physical_processor_count
34
35
  end
35
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  VHNmKzZNYWVud0FNa0FnSGRzd0dzSnp0T25ObkJhM0YKeTBrQ1NXbUs2RCt4
37
37
  L1NiZlM2cjdLZTA3TVJxemlKZEI5R3VFMSswY0lSdUZoOEVRK0xONkhYQ0tN
38
38
  NXBvbi9HVQp5Y3dNWGZsMAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2013-03-30 00:00:00.000000000 Z
39
+ date: 2013-05-14 00:00:00.000000000 Z
40
40
  dependencies: []
41
41
  description:
42
42
  email: michael@grosser.it
@@ -44,6 +44,7 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - .travis.yml
47
48
  - Gemfile
48
49
  - Gemfile.lock
49
50
  - MIT-LICENSE.txt
@@ -99,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
100
  version: '0'
100
101
  segments:
101
102
  - 0
102
- hash: -2205036652942743668
103
+ hash: 4198447693548042537
103
104
  required_rubygems_version: !ruby/object:Gem::Requirement
104
105
  none: false
105
106
  requirements:
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  version: '0'
109
110
  segments:
110
111
  - 0
111
- hash: -2205036652942743668
112
+ hash: 4198447693548042537
112
113
  requirements: []
113
114
  rubyforge_project:
114
115
  rubygems_version: 1.8.25
metadata.gz.sig CHANGED
Binary file