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.171.1726,500262  0% 1% 2% 100%
5,000,00010.6610.6627,796262  1% 1% 0% 100%
50,000,000103.97104.0353,716262  0% 1% 0% 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.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 01:27:50 GMT

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


Revised BSD license

  Home   Conclusions   License   Play