/mobile Handheld Friendly website

 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.555.57180,436299  0% 1% 1% 100%
5,000,00013.7713.80382,720299  0% 1% 1% 100%
50,000,00083.5883.67383,832299  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.

 notes

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Server VM (build 25.0-b70, mixed mode)

Clojure 1.6.0

 thread-ring Clojure #2 program source code

;; The Computer Language Benchmarks Game
;; http://benchmarksgame.alioth.debian.org/
;;
;; 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))
    slot)

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

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

 make, command-line, and program output logs

Sat, 19 Apr 2014 00:57:15 GMT

MAKE:
mv threadring.clojure-2.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 .
1.88s 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