performance measurements

Each table row shows performance measurements for this Racket program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,0001.421.4244,296262  99% 1% 1% 3%
5,000,00011.7011.7147,432262  1% 1% 1% 100%
50,000,000110.38110.44116,232262  1% 0% 100% 1%

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.


Welcome to Racket v6.1.1.

 thread-ring Racket program source code

#lang racket/base

;;; The Computer Language Benchmarks Game

;;; contributed by Matthew Flatt

;; Uses Racket threads

(require racket/cmdline)

;; Each thread runs this loop:
(define (run id next)
  (let ([v (thread-receive)])
     [(zero? v) ;; Done
      (printf "~a\n" id)
     [else ;; Keep going
      (thread-send next (sub1 v))
      (run id next)])))

(let ([n (command-line #:args (n) (string->number n))])
  ;; The original thread is #503. Create the rest:
  (let ([t1 (for/fold ([next (current-thread)])
                      ([id (in-range 502 0 -1)])
              (thread (lambda () (run id next))))])
    ;; Start:
    (thread-send t1 n)
    (run 503 t1)))

 make, command-line, and program output logs

Sat, 04 Apr 2015 04:31:19 GMT

/usr/local/src/racket-6.1.1/bin/racket  threadring.racket 50000000


Revised BSD license

  Home   Conclusions   License   Play