Quicksort: Executor vs Fork Join

192 views
Skip to first unread message

Marceli Narcyz

unread,
May 7, 2013, 6:10:58 PM5/7/13
to java...@googlegroups.com
I benchmarked a few Java parallel compute frameworks with a simple quick sort:

https://github.com/marcelinarcyz/quicksortjmh

Can anyone offer any improvement suggestions of better alternatives? I know there are faster sorting algorithms, but I'm interested in the compute framework piece itself. thanks!

John May

unread,
May 8, 2013, 5:43:18 AM5/8/13
to java...@googlegroups.com
Very interesting. I've had quite good results with fork/join but for simply processing large arrays in chunks. I've had a quick look at the fork/join implementation and it looks like you create a new task for each recursive step but I could be wrong. If so, try adding a threshold to determine whether the size of the partition is worth forking (e.g. 20,000+). WIthout the conditional you will create many short running threads for sorting the small partitions. 
Reply all
Reply to author
Forward
0 new messages