相关疑难解决方法(0)

是否有可能在Haskell中加速快速排名?

我有这个看似琐碎的并行快速实现,代码如下:

import System.Random
import Control.Parallel
import Data.List

quicksort :: Ord a => [a] -> [a]
quicksort xs = pQuicksort 16 xs -- 16 is the number of sparks used to sort

-- pQuicksort, parallelQuicksort  
-- As long as n > 0 evaluates the lower and upper part of the list in parallel,
-- when we have recursed deep enough, n==0, this turns into a serial quicksort.
pQuicksort :: Ord a => Int -> [a] -> [a]
pQuicksort _ [] = …
Run Code Online (Sandbox Code Playgroud)

parallel-processing profiling haskell quicksort

14
推荐指数
3
解决办法
1544
查看次数