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.212.64194,500299  43% 55% 38% 62%
5,000,00014.9111.30398,244299  38% 31% 30% 32%
50,000,00097.9289.71395,820299  33% 22% 21% 33%

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

Tue, 30 Jun 2015 23:33:19 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.53s 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