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.265.28193,100299  1% 1% 1% 100%
5,000,00013.1113.12394,360299  1% 0% 1% 100%
50,000,00083.3483.45395,232299  0% 1% 1% 100%

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.


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)

Clojure 1.7.0

 thread-ring Clojure #2 program source code

;; The Computer Language Benchmarks Game
;; 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))

(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 }))
                        (range ring-sz 1 -1)) })

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

 make, command-line, and program output logs

Wed, 01 Jul 2015 02:12:15 GMT

mv threadring.clojure-2.clojure threadring.clj
/usr/local/src/jdk1.8.0_45/bin/java -Dclojure.compile.path=. -cp .:/usr/local/src/clojure/clojure-1.7.0.jar: clojure.lang.Compile threadring
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Compiling threadring to .
1.54s to complete and log all make actions

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


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

Revised BSD license

  Home   Conclusions   License   Play