Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The CPU is indeed slower on SPARC (1.2Ghz) and as answered by one of the Sun's engineers T2 is usualy 3 times slower for single-threaded application than modern Intel processors. Though, he also stated that in a multi-threaded environment SPARC should be faster.</p> <p>I have made a multi-threaded test using GroboUtils library and tested both allocations (through concatenations) and simple calculations ( a += j*j ) to test processor. And I've got the following results:</p> <pre><code>1 thread : Intel : Calculations test : 43ms 100 threads : Intel : Calculations test : 225ms 1 thread : Intel : Allocations test : 35ms 100 threads : Intel : Allocations test : 1754ms 1 thread : SPARC : Calculations test : 197ms 100 threads : SPARC : Calculations test : 261ms 1 thread : SPARC : Allocations test : 236ms 100 threads : SPARC : Allocations test : 1517ms </code></pre> <p>SPARC shows its power here by outperforming Intel on 100 threads.</p> <p>Here goes the multi-threaded calculation test:</p> <pre><code>import java.util.ArrayList; import java.util.List; import net.sourceforge.groboutils.junit.v1.MultiThreadedTestRunner; import net.sourceforge.groboutils.junit.v1.TestRunnable; import junit.framework.TestCase; public class TM1_CalculationSpeedTest extends TestCase { public void testCalculation() throws Throwable { List threads = new ArrayList(); for (int i = 0; i &lt; 100; i++) { threads.add(new Requester()); } MultiThreadedTestRunner mttr = new MultiThreadedTestRunner((TestRunnable[]) threads.toArray(new TestRunnable[threads.size()])); mttr.runTestRunnables(2 * 60 * 1000); } public class Requester extends TestRunnable { public void runTest() throws Exception { long startTime = System.currentTimeMillis(); long a = 0; for (int j = 0; j &lt; 10000000; j++) { a += j * j; } long endTime = System.currentTimeMillis(); System.out.println(this + ": " + (endTime - startTime) + "ms " + a); } } } </code></pre> <p>Here goes the multi-threaded allocation test:</p> <pre><code>import java.util.ArrayList; import java.util.List; import junit.framework.TestCase; import net.sourceforge.groboutils.junit.v1.MultiThreadedTestRunner; import net.sourceforge.groboutils.junit.v1.TestRunnable; public class TM2_AllocationSpeedTest extends TestCase { public void testAllocation() throws Throwable { List threads = new ArrayList(); for (int i = 0; i &lt; 100; i++) { threads.add(new Requester()); } MultiThreadedTestRunner mttr = new MultiThreadedTestRunner((TestRunnable[]) threads.toArray(new TestRunnable[threads.size()])); mttr.runTestRunnables(2 * 60 * 1000); } public class Requester extends TestRunnable { public void runTest() throws Exception { long startTime = System.currentTimeMillis(); String a = "dummy"; for (int j = 0; j &lt; 1000; j++) { a += "allocation driven"; } long endTime = System.currentTimeMillis(); System.out.println(this + ": " + (endTime - startTime) + "ms " + a.length()); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload