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.711.7124,000262  1% 1% 1% 100%
5,000,00016.2916.3026,716262  0% 1% 1% 100%
50,000,000163.53163.6151,060262  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.


Welcome to Racket v6.0.

 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

Fri, 28 Feb 2014 06:17:01 GMT

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


Revised BSD license

  Home   Conclusions   License   Play