<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Blog::Quibb</title>
	<atom:link href="http://blog.quibb.org/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.quibb.org</link>
	<description>Software development and more.</description>
	<lastBuildDate>Mon, 19 Jul 2010 14:45:18 -0400</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>Comment on Passing Parameters Between Builds in Hudson by Nightly Benchmarks: Tracking Results with Codespeed - Blog::Quibb</title>
		<link>http://blog.quibb.org/2010/04/passing-parameters-between-builds-in-hudson/comment-page-1/#comment-374</link>
		<dc:creator>Nightly Benchmarks: Tracking Results with Codespeed - Blog::Quibb</dc:creator>
		<pubDate>Mon, 19 Jul 2010 14:45:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quibb.org/?p=192#comment-374</guid>
		<description>[...] ago I talked about running nightly benchmarks with Hudson. Then in the previous post I discussed passing parameters between builds in Hudson. Both of these posts are worth reading before trying to setup Hudson with [...]</description>
		<content:encoded><![CDATA[<p>[...] ago I talked about running nightly benchmarks with Hudson. Then in the previous post I discussed passing parameters between builds in Hudson. Both of these posts are worth reading before trying to setup Hudson with [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JSR-166: The Java fork/join Framework by Prabh</title>
		<link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-371</link>
		<dc:creator>Prabh</dc:creator>
		<pubDate>Fri, 16 Jul 2010 02:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-371</guid>
		<description>Thanks. It solved the problem</description>
		<content:encoded><![CDATA[<p>Thanks. It solved the problem</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JSR-166: The Java fork/join Framework by Joe</title>
		<link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-370</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Thu, 15 Jul 2010 22:35:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-370</guid>
		<description>You&#039;re not doing an apples to apples comparison.  

The problem lies here:
Integer[] data = new Integer[size];
int[] temp = new int[size];
int[] temp2 = new int[size];

It should be:
Integer[] data = new Integer[size];
Integer[] temp = new Integer[size];
Integer[] temp2 = new Integer[size];

You&#039;re comparing an array of objects to an array of ints.  Java operates faster on primitive types.

Also, when benchmarking it&#039;s a good idea to take the average of several runs.</description>
		<content:encoded><![CDATA[<p>You&#8217;re not doing an apples to apples comparison.  </p>
<p>The problem lies here:<br />
Integer[] data = new Integer[size];<br />
int[] temp = new int[size];<br />
int[] temp2 = new int[size];</p>
<p>It should be:<br />
Integer[] data = new Integer[size];<br />
Integer[] temp = new Integer[size];<br />
Integer[] temp2 = new Integer[size];</p>
<p>You&#8217;re comparing an array of objects to an array of ints.  Java operates faster on primitive types.</p>
<p>Also, when benchmarking it&#8217;s a good idea to take the average of several runs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JSR-166: The Java fork/join Framework by Prabh</title>
		<link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-369</link>
		<dc:creator>Prabh</dc:creator>
		<pubDate>Thu, 15 Jul 2010 21:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-369</guid>
		<description>I wrote one program to check the speed up happens due to ParallelArray predefined sort() method. However, it is running even slower than the sequential algorithm. Am I missing something in my code ? If not, then whats the point having a sort function in ParallelArray class as opposed to Arrays.sort(). Actually Arrays.sort() is even faster than parallel code written using Java 7 invoke() method. Here&#039;s the code:

import java.util.Arrays;

import jsr166y.*;
import extra166y.*;

public class TestParallelArray {
  public static void main(String[] args) {

    int size = 15000000;
    Integer[] data = new Integer[size];
    int[] temp = new int[size];
    int[] temp2 = new int[size];

    for (int i = 0; i &lt; size; i++) {
      data[i] = new Integer((int)(Math.random()*10000000));
      temp[i] = data[i];
      temp2[i] = data[i];
    }
    
    ForkJoinPool forkJoinPool = new ForkJoinPool();
    ParallelArray parallelArray =  ParallelArray.createFromCopy(data, forkJoinPool);

    TestParallelArray testParallelArray = new TestParallelArray();
    
    System.out.println(&quot;Sorting now&quot;);
    long start = System.currentTimeMillis();
    testParallelArray.shuttleSort(temp2, temp, 0, size);
    long finish = System.currentTimeMillis();
    System.out.println(&quot;Time taken = &quot; + (finish - start) + &quot; milliseconds (Using sequential)&quot;);
    
    start = System.currentTimeMillis();
    forkJoinPool.invoke(testParallelArray.new SortTask(temp2, temp, 0, size));
    finish = System.currentTimeMillis();
    System.out.println(&quot;Time taken = &quot; + (finish - start) + &quot; milliseconds (Parallel using invoke command)&quot;);
    
    start = System.currentTimeMillis();
    parallelArray = parallelArray.sort(); //Even if i convert this line to &quot;parallelArray.sort()&quot; clock time almost remains same
    finish = System.currentTimeMillis();
    System.out.println(&quot;Time taken = &quot; + (finish - start) + &quot; milliseconds (Using Parallel Sort)&quot;);
    
    start = System.currentTimeMillis();
    Arrays.sort(temp); //Even if i convert this line to &quot;parallelArray.sort()&quot; clock time almost remains same
    finish = System.currentTimeMillis();
    System.out.println(&quot;Time taken = &quot; + (finish - start) + &quot; milliseconds (Using Arrays.sort())&quot;);
   
  }

  private void shuttleSort(int[] from, int[] to, int low, int high) {
    if (high - low == 1) {
      return;
    }
    int middle = (low + high) / 2;
    shuttleSort(to, from, low, middle);
    shuttleSort(to, from, middle, high);

    int p = low;
    int q = middle;

    if (high - low &gt;= 4 &amp;&amp; from[middle - 1] &lt;= from[middle]) {
      for (int i = low; i &lt; high; i++) {
        to[i] = from[i];
      }
      return;
    }

    for (int i = low; i = high &#124;&#124; (p &lt; middle &amp;&amp; from[p] = 4 &amp;&amp; from[middle - 1] &lt;= from[middle]) {
        for (int i = low; i &lt; high; i++) {
          to[i] = from[i];
        }
        return;
      }

      for (int i = low; i = high &#124;&#124; (p &lt; middle &amp;&amp; from[p] &lt;= from[q])) {
          to[i] = from[p++];
        }
        else {
          to[i] = from[q++];
        }
      }
    }  
  }

}</description>
		<content:encoded><![CDATA[<p>I wrote one program to check the speed up happens due to ParallelArray predefined sort() method. However, it is running even slower than the sequential algorithm. Am I missing something in my code ? If not, then whats the point having a sort function in ParallelArray class as opposed to Arrays.sort(). Actually Arrays.sort() is even faster than parallel code written using Java 7 invoke() method. Here&#8217;s the code:</p>
<p>import java.util.Arrays;</p>
<p>import jsr166y.*;<br />
import extra166y.*;</p>
<p>public class TestParallelArray {<br />
  public static void main(String[] args) {</p>
<p>    int size = 15000000;<br />
    Integer[] data = new Integer[size];<br />
    int[] temp = new int[size];<br />
    int[] temp2 = new int[size];</p>
<p>    for (int i = 0; i &lt; size; i++) {<br />
      data[i] = new Integer((int)(Math.random()*10000000));<br />
      temp[i] = data[i];<br />
      temp2[i] = data[i];<br />
    }</p>
<p>    ForkJoinPool forkJoinPool = new ForkJoinPool();<br />
    ParallelArray parallelArray =  ParallelArray.createFromCopy(data, forkJoinPool);</p>
<p>    TestParallelArray testParallelArray = new TestParallelArray();</p>
<p>    System.out.println(&#8220;Sorting now&#8221;);<br />
    long start = System.currentTimeMillis();<br />
    testParallelArray.shuttleSort(temp2, temp, 0, size);<br />
    long finish = System.currentTimeMillis();<br />
    System.out.println(&#8220;Time taken = &#8221; + (finish &#8211; start) + &#8221; milliseconds (Using sequential)&#8221;);</p>
<p>    start = System.currentTimeMillis();<br />
    forkJoinPool.invoke(testParallelArray.new SortTask(temp2, temp, 0, size));<br />
    finish = System.currentTimeMillis();<br />
    System.out.println(&#8220;Time taken = &#8221; + (finish &#8211; start) + &#8221; milliseconds (Parallel using invoke command)&#8221;);</p>
<p>    start = System.currentTimeMillis();<br />
    parallelArray = parallelArray.sort(); //Even if i convert this line to &#8220;parallelArray.sort()&#8221; clock time almost remains same<br />
    finish = System.currentTimeMillis();<br />
    System.out.println(&#8220;Time taken = &#8221; + (finish &#8211; start) + &#8221; milliseconds (Using Parallel Sort)&#8221;);</p>
<p>    start = System.currentTimeMillis();<br />
    Arrays.sort(temp); //Even if i convert this line to &#8220;parallelArray.sort()&#8221; clock time almost remains same<br />
    finish = System.currentTimeMillis();<br />
    System.out.println(&#8220;Time taken = &#8221; + (finish &#8211; start) + &#8221; milliseconds (Using Arrays.sort())&#8221;);</p>
<p>  }</p>
<p>  private void shuttleSort(int[] from, int[] to, int low, int high) {<br />
    if (high &#8211; low == 1) {<br />
      return;<br />
    }<br />
    int middle = (low + high) / 2;<br />
    shuttleSort(to, from, low, middle);<br />
    shuttleSort(to, from, middle, high);</p>
<p>    int p = low;<br />
    int q = middle;</p>
<p>    if (high &#8211; low &gt;= 4 &amp;&amp; from[middle - 1] &lt;= from[middle]) {<br />
      for (int i = low; i &lt; high; i++) {<br />
        to[i] = from[i];<br />
      }<br />
      return;<br />
    }</p>
<p>    for (int i = low; i = high || (p &lt; middle &amp;&amp; from[p] = 4 &amp;&amp; from[middle - 1] &lt;= from[middle]) {<br />
        for (int i = low; i &lt; high; i++) {<br />
          to[i] = from[i];<br />
        }<br />
        return;<br />
      }</p>
<p>      for (int i = low; i = high || (p &lt; middle &amp;&amp; from[p] &lt;= from[q])) {<br />
          to[i] = from[p++];<br />
        }<br />
        else {<br />
          to[i] = from[q++];<br />
        }<br />
      }<br />
    }<br />
  }</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JSR-166: The Java fork/join Framework by Riccardo</title>
		<link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-275</link>
		<dc:creator>Riccardo</dc:creator>
		<pubDate>Tue, 27 Apr 2010 16:12:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-275</guid>
		<description>Good performance, i compared your parallel merge sort to the standard java Arrays.sort() and the time needed is an half with two processors. 

Optimal!</description>
		<content:encoded><![CDATA[<p>Good performance, i compared your parallel merge sort to the standard java Arrays.sort() and the time needed is an half with two processors. </p>
<p>Optimal!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
