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,0004.862.62212,728348  54% 54% 38% 39%
5,000,00012.509.89409,356348  37% 22% 22% 45%
50,000,00089.6683.20410,376348  32% 22% 23% 31%

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_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Clojure 1.7

 thread-ring Clojure program source code

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

(ns threadring
  (:gen-class))

(set! *warn-on-reflection* true)

(defn pass-message
  [the-agent
   ^Integer value
   first-agent]
  (if (zero? value)
    (do (println (:num the-agent))
      (shutdown-agents)
      (System/exit 0))
    ; Pass to the next agent if we're not at the end of the line,
    ; otherwise back to the first.
    (send (if (:next the-agent) (:next the-agent) first-agent)
          pass-message (dec value) first-agent))
  the-agent)

(defn pass-messages
  [^Integer num-agents
   ^Integer num-messages]
  (let [first-agent (reduce (fn [next-agent agent-num]
                              (agent {:next next-agent :num agent-num}))
                            nil
                            (range num-agents 0 -1))]
    (send first-agent pass-message num-messages first-agent)))

(defn -main [& args]
  (let [num-messages (if (empty? args)
                       1000
                       (Integer/valueOf (first args)))]
    (pass-messages 503 num-messages)))

 make, command-line, and program output logs

Tue, 30 Jun 2015 19:11:30 GMT

MAKE:
mv threadring.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 .
Reflection warning, threadring.clj:37:24 - call to static method valueOf on java.lang.Integer can't be resolved (argument types: unknown).
1.53s to complete and log all make actions

COMMAND LINE:
/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

PROGRAM OUTPUT:
292

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

Revised BSD license

  Home   Conclusions   License   Play