<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,10 +1,53 @@
 module Peach
   def peach(n = nil, &amp;b)
-    peach_run(:each, b, n)
+    return [] if n == 0 or size == 0
+
+    result = Array.new(size)
+
+    n ||= $peach_default_threads || size
+    div = (size/n).ceil
+
+    return [] if div == 0
+
+    threads = []
+    max = size - 1
+    offset = 0
+    for i in (0..n-1)
+      threads &lt;&lt; Thread.new(offset - div, offset &gt; max ? max : offset) do |lower, upper|
+        for j in lower..upper
+          yield(slice(j))
+        end
+      end
+      offset += div
+    end
+    threads.each { |t| t.join }
+    self
   end
 
   def pmap(n = nil, &amp;b)
-    peach_run(:map, b, n)
+    return [] if n == 0
+
+    n ||= $peach_default_threads || size
+    div = (size/n).ceil
+
+    return [] if div == 0
+
+    result = Array.new(size)
+
+    threads = []
+    max = size - 1
+    offset = div
+    for i in (0..n-1)
+      threads &lt;&lt; Thread.new(offset - div, offset &gt; max ? max : offset) do |lower, upper|
+        for j in lower..upper
+          result[j] = yield(slice(j))
+        end
+      end
+      offset += div
+    end
+    threads.each { |t| t.join }
+
+    result
   end
 
   def pselect(n = nil, &amp;b)</diff>
      <filename>lib/peach.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 Gem::Specification.new do |s|
   s.name = 'peach'
-  s.version = '0.2'
-  s.date = '2009-04-05'
+  s.version = '0.3'
+  s.date = '2009-07-14'
   s.authors = ['Ben Hughes']
   s.email = 'ben@pixelmachine.org'
   s.summary = 'Parallel Each and other parallel things'</diff>
      <filename>peach.gemspec</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>68edd5d72c9bf0ab629c546c33974ca1f9768712</id>
    </parent>
  </parents>
  <author>
    <name>Rob Brit</name>
    <email>rob.s.brit@gmail.com</email>
  </author>
  <url>http://github.com/schleyfox/peach/commit/8d4910dd454ca5ad270d6e2d4fe8ff680c10e226</url>
  <id>8d4910dd454ca5ad270d6e2d4fe8ff680c10e226</id>
  <committed-date>2009-07-14T06:50:39-07:00</committed-date>
  <authored-date>2009-07-14T06:50:39-07:00</authored-date>
  <message>Optimizations that reduce memory usage a lot.</message>
  <tree>f731232ea3a19fec05fa0ceb51bf7a9e222f56cd</tree>
  <committer>
    <name>Ben Hughes</name>
    <email>ben@pixelmachine.org</email>
  </committer>
</commit>
