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.773.01146,352348  61% 34% 52% 48%
5,000,00017.6713.59161,872348  34% 31% 30% 34%
50,000,000135.32118.44184,744348  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) 64-Bit Server VM (build 25.0-b70, mixed mode)

Clojure 1.6

 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

Fri, 18 Apr 2014 21:09:47 GMT

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