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.705.71189,804348  0% 1% 1% 100%
5,000,00013.6313.65387,904348  1% 0% 0% 100%
50,000,00085.7685.87392,352348  0% 2% 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.

 notes

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) Server VM (build 25.25-b02, mixed mode)

Clojure 1.6.0

 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

Thu, 20 Nov 2014 04:36:20 GMT

MAKE:
mv threadring.clojure threadring.clj
/usr/local/src/jdk1.8.0_25/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.56s to complete and log all make actions

COMMAND LINE:
/usr/local/src/jdk1.8.0_25/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