Created
June 2, 2010 02:34
-
-
Save rbxbx/421840 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'peach' | |
[1,2,3,4].peach{ |n| n + 1 } #Spawns 4 threads | |
[1,2,3,4].pmap{ |x| f(x) } #Spawns 4 threads, returns => [f(1),f(2),f(3),f(4)] | |
[1,2,3,4].pselect{ |x| x > 2 } #Spawns 4 threads, returns => [3,4] |
you're correct!
Fixed, thanks.
I want to know more about this. How does it handle "unbalanced" CPU loads. For instance, one operation takes 30 seconds, and the rest all take 2. Also, how does it glean enough knowledge to know the "correct" number of threads for your block? Clojure has a really sexy pmap, preduce, etc. coming in 1.3 and after learning about how it actually I'm skeptical of this library and its effectiveness. How do these pmethods behave when they're thrown tasks which require variable lengths of time?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
reading the blog post, shouldn't that be a pselect in line 5?