performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,0005.232.90183,888299  68% 44% 36% 33%
5,000,00016.8613.35380,340299  33% 28% 28% 34%
50,000,000138.16120.48381,192299  31% 26% 26% 29%

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

Read thread-ring benchmark to see what this program should do.

 notes

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Server VM (build 25.0-b70, mixed mode)

Clojure 1.6.0

 thread-ring Clojure #2 program source code

;; The Computer Language Benchmarks Game
;; http://benchmarksgame.alioth.debian.org/
;;
;; contributed by Kenneth Jonsson

(ns threadring (:gen-class))

(defn pass-token [ slot value ]
    (when (zero? value)
        (println (:id slot))
        (System/exit 0))
    (send (:next slot) pass-token (dec value))
    slot)

(defn create-ring-and-start [ _ ring-sz initial-value ]
    ; "send" will be defered until the state of the current agent has
    ; been set to the state returned by this function
    (send *agent* pass-token initial-value)
    ; create a ring of "ring-sz" agents linked via ":next"
    { :id 1
      :next (reduce (fn [ next-slot id ]
                        (agent { :next next-slot :id id }))
                        *agent*
                        (range ring-sz 1 -1)) })

(defn -main [ & args ]
    (send (agent nil)
          create-ring-and-start
	  503
          (if (empty? args) 1000 (Integer/parseInt (first args)))))

 make, command-line, and program output logs

Sat, 19 Apr 2014 02:09:40 GMT

MAKE:
mv threadring.clojure-2.clojure threadring.clj
/usr/local/src/jdk1.8.0/bin/java -Dclojure.compile.path=. -cp .:/usr/local/src/clojure/clojure-1.6.0.jar clojure.lang.Compile threadring
Compiling threadring to .
1.53s to complete and log all make actions

COMMAND LINE:
/usr/local/src/jdk1.8.0/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts  -cp .:/usr/local/src/clojure/clojure-1.6.0.jar threadring 50000000

PROGRAM OUTPUT:
292

Revised BSD license

  Home   Conclusions   License   Play