<?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 on: JSR-166: The Java fork/join Framework</title> <atom:link href="http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/feed/" rel="self" type="application/rss+xml" /><link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/</link> <description>Software development and more.</description> <lastBuildDate>Fri, 20 Jan 2012 03:48:26 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Joe</title><link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-864</link> <dc:creator>Joe</dc:creator> <pubDate>Fri, 19 Aug 2011 05:06:34 +0000</pubDate> <guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-864</guid> <description>It’s probably around 29 bytes per element because of Object overhead. Each Integer is an object and not stored directly in the array. If it is an array of primitive ints, it would take less space and probably be faster.</description> <content:encoded><![CDATA[<p>It’s probably around 29 bytes per element because of Object overhead. Each Integer is an object and not stored directly in the array. If it is an array of primitive ints, it would take less space and probably be faster.</p> ]]></content:encoded> </item> <item><title>By: Graham Seed</title><link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-844</link> <dc:creator>Graham Seed</dc:creator> <pubDate>Thu, 18 Aug 2011 10:19:57 +0000</pubDate> <guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-844</guid> <description>Hi JoeThanks for your reply. I added the -Xmx3g command to the vm command-line options in NetBeans and it ran successfully.What I don&#039;t get is that the default runtime heap is 64m. It requires 3,000m, so the 100e6 array of Integers requires 2,936m which is equivalent to ~29bytes per element. With each int requiring 4bytes do you know why it requires ~29bytes per element?I noticed when compiling your sequential MergeSort that I get unchecked call warnings on all of the calls to compareTo(). I also noticed that you use Comparable without using generics although Comparable is a generic type. Thus, I rewrote the MergeSort class to have declaration:public class MergeSort&lt;T extends Comparable&gt; { //...The static method syntax does support generics but the syntax gets very messy so I decided to add type T to the class.I replaced every instance of &quot;Comparable&quot; with &quot;T&quot;.The only difficulty arose in method sort() with:Comparable[] tmp = new Comparable[((hi - lo) / 2) + 1];having to be replaced by:T[] tmp = (T[])Array.newInstance(a.getClass().getComponentType(), ((hi - lo) / 2) + 1);which is still an unchecked cast! And required:@SuppressWarnings(&quot;unchecked&quot;)before the method declaration.Thus, it would appear that there is no escape from the unchecked call/cast!!Graham</description> <content:encoded><![CDATA[<p>Hi Joe</p><p>Thanks for your reply. I added the -Xmx3g command to the vm command-line options in NetBeans and it ran successfully.</p><p>What I don&#8217;t get is that the default runtime heap is 64m. It requires 3,000m, so the 100e6 array of Integers requires 2,936m which is equivalent to ~29bytes per element. With each int requiring 4bytes do you know why it requires ~29bytes per element?</p><p>I noticed when compiling your sequential MergeSort that I get unchecked call warnings on all of the calls to compareTo(). I also noticed that you use Comparable without using generics although Comparable is a generic type. Thus, I rewrote the MergeSort class to have declaration:</p><p>public class MergeSort&lt;T extends Comparable&gt;<br /> {<br /> //&#8230;</p><p>The static method syntax does support generics but the syntax gets very messy so I decided to add type T to the class.</p><p>I replaced every instance of &#8220;Comparable&#8221; with &#8220;T&#8221;.</p><p>The only difficulty arose in method sort() with:</p><p>Comparable[] tmp = new Comparable[((hi - lo) / 2) + 1];</p><p>having to be replaced by:</p><p>T[] tmp = (T[])Array.newInstance(a.getClass().getComponentType(), ((hi &#8211; lo) / 2) + 1);</p><p>which is still an unchecked cast! And required:</p><p>@SuppressWarnings(&#8220;unchecked&#8221;)</p><p>before the method declaration.</p><p>Thus, it would appear that there is no escape from the unchecked call/cast!!</p><p>Graham</p> ]]></content:encoded> </item> <item><title>By: Joe</title><link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-829</link> <dc:creator>Joe</dc:creator> <pubDate>Thu, 18 Aug 2011 02:32:20 +0000</pubDate> <guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-829</guid> <description>Graham,I did some experimentation, and it looks like you&#039;ll need to let the Java heap grow to about 3GB.  This can be done with the command line option: -Xmx3072M.After doing that, it was able to finish allocating all of the integers.</description> <content:encoded><![CDATA[<p>Graham,</p><p>I did some experimentation, and it looks like you&#8217;ll need to let the Java heap grow to about 3GB.  This can be done with the command line option: -Xmx3072M.</p><p>After doing that, it was able to finish allocating all of the integers.</p> ]]></content:encoded> </item> <item><title>By: Graham Seed</title><link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-802</link> <dc:creator>Graham Seed</dc:creator> <pubDate>Wed, 17 Aug 2011 08:43:38 +0000</pubDate> <guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-802</guid> <description>HiI implemented your sequential merge sort and setup a test that fills an array with random numbers:int size = (int)1e8; Integer[] iarray = new Integer[size]; RandomNumber rn = new RandomNumber(); for (int i=0; i&lt;size; i++) { int number = (int)rn.numberInRange(0,size); iarray[i] = new Integer(number); }The random number generator is my own and simply returns a random number within a range.With the shown size of 1e08 for the array length I get the following exception:Exception in thread &quot;main&quot; java.lang.OutOfMemoryError: Java heap space at hedgehog_samples.utility.MergeSortSample.main(MergeSortSample.java:44)I was wondering how you would perform such a test? Do I need to allocate a runtime parameter to allocate a larger block of memory?If I set the array size to 1e06 then it performs the sort almost immediately and hence to perform a proper test of this sort I need to have much larger array lengths.Thanks.</description> <content:encoded><![CDATA[<p>Hi</p><p>I implemented your sequential merge sort and setup a test that fills an array with random numbers:</p><p> int size = (int)1e8;<br /> Integer[] iarray = new Integer[size];<br /> RandomNumber rn = new RandomNumber();<br /> for (int i=0; i&lt;size; i++)<br /> {<br /> int number = (int)rn.numberInRange(0,size);<br /> iarray[i] = new Integer(number);<br /> }</p><p>The random number generator is my own and simply returns a random number within a range.</p><p>With the shown size of 1e08 for the array length I get the following exception:</p><p>Exception in thread &quot;main&quot; java.lang.OutOfMemoryError: Java heap space<br /> at hedgehog_samples.utility.MergeSortSample.main(MergeSortSample.java:44)</p><p>I was wondering how you would perform such a test? Do I need to allocate a runtime parameter to allocate a larger block of memory?</p><p>If I set the array size to 1e06 then it performs the sort almost immediately and hence to perform a proper test of this sort I need to have much larger array lengths.</p><p>Thanks.</p> ]]></content:encoded> </item> <item><title>By: Joe</title><link>http://blog.quibb.org/2010/03/jsr-166-the-java-forkjoin-framework/comment-page-1/#comment-610</link> <dc:creator>Joe</dc:creator> <pubDate>Tue, 09 Aug 2011 01:32:53 +0000</pubDate> <guid isPermaLink="false">http://blog.quibb.org/?p=153#comment-610</guid> <description>That&#039;s a good point.  When looking into these types of articles, I generally look for parallel algorithms.  Processing files in parallel seems like something that might be more useful to a wider audience.</description> <content:encoded><![CDATA[<p>That&#8217;s a good point.  When looking into these types of articles, I generally look for parallel algorithms.  Processing files in parallel seems like something that might be more useful to a wider audience.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 3/13 queries in 0.006 seconds using disk
Object Caching 328/337 objects using disk

Served from: blog.quibb.org @ 2012-02-05 12:42:19 -->
