performance measurements

Each table row shows performance measurements for this Java program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1,0000.300.30468802  0% 0% 3% 97%
4,0002.032.0326,084802  1% 0% 1% 100%
16,00028.5928.6088,700802  1% 0% 1% 100%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read mandelbrot benchmark to see what this program should do.


java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)

Compare to "Warmed" JVM timings using System.nanoTime() - see Help: What about Java?

 mandelbrot Java #6 program source code

/* The Computer Language Benchmarks Game
 * contributed by Stefan Krause
 * slightly modified by Chad Whipkey
 * parallelized by Colin D Bennett 2008-10-04
 * reduce synchronization cost by The Anh Tran
 * optimizations and refactoring by Enotus 2010-11-11

import java.util.concurrent.atomic.AtomicInteger;

public final class mandelbrot {
    static byte[][] out;
    static AtomicInteger yCt;
    static double[] Crb;
    static double[] Cib;

    static int getByte(int x, int y){
        double Ci=Cib[y];
        int res=0;
        for(int i=0;i<8;i+=2){
            double Zr1=Crb[x+i];
            double Zi1=Cib[y];

            double Zr2=Crb[x+i+1];
            double Zi2=Cib[y];

            int b=0;
            int j=49;do{
                double nZr1=Zr1*Zr1-Zi1*Zi1+Crb[x+i];
                double nZi1=Zr1*Zi1+Zr1*Zi1+Cib[y];

                double nZr2=Zr2*Zr2-Zi2*Zi2+Crb[x+i+1];
                double nZi2=Zr2*Zi2+Zr2*Zi2+Cib[y];

                if(Zr1*Zr1+Zi1*Zi1>4) b|=2;
                if(Zr2*Zr2+Zi2*Zi2>4) b|=1;
                if(b==3) break;
        return res^-1;
    static void putLine(int y, byte[] line){
        for (int xb=0; xb<line.length; xb++)
    public static void main(String[] args) throws Exception {
        int N=6000;
        if (args.length>=1) N=Integer.parseInt(args[0]);

        Crb=new double[N+7]; Cib=new double[N+7];
        double invN=2.0/N; for(int i=0;i<N;i++){ Cib[i]=i*invN-1.0; Crb[i]=i*invN-1.5; }
        yCt=new AtomicInteger();
        out=new byte[N][(N+7)/8];

        Thread[] pool=new Thread[2*Runtime.getRuntime().availableProcessors()];
        for (int i=0;i<pool.length;i++)
            pool[i]=new Thread(){
                public void run() {
                     int y; while((y=yCt.getAndIncrement())<out.length) putLine(y,out[y]);
        for (Thread t:pool) t.start();
        for (Thread t:pool) t.join();

        OutputStream stream = new BufferedOutputStream(System.out);
        stream.write(("P4\n"+N+" "+N+"\n").getBytes());
        for(int i=0;i<N;i++) stream.write(out[i]);

 make, command-line, and program output logs

Tue, 19 May 2015 03:06:51 GMT

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
0.79s to complete and log all make actions

/usr/local/src/jdk1.8.0_45/bin/java  -server -XX:+TieredCompilation -XX:+AggressiveOpts mandelbrot 16000


Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 

Revised BSD license

  Home   Conclusions   License   Play