This commit is contained in:
Justin Ethier 2017-01-26 18:43:52 -05:00
parent 7b2a4991a7
commit 8c6c27b3d6
2 changed files with 33 additions and 4 deletions

View file

@ -1,6 +1,6 @@
;;; CTAK -- A version of the TAK procedure that uses continuations. ;;; CTAK -- A version of the TAK procedure that uses continuations.
(import (scheme base) (scheme read) (scheme write) (scheme time)) (import (scheme base) (scheme read) (scheme write) (scheme time) (srfi 18))
(define (ctak x y z) (define (ctak x y z)
(call-with-current-continuation (call-with-current-continuation
@ -35,7 +35,26 @@
(string-append name ":" s1 ":" s2 ":" s3 ":" s4) (string-append name ":" s1 ":" s2 ":" s3 ":" s4)
count count
(lambda () (lambda ()
(ctak (hide count input1) (hide count input2) (hide count input3))) (thread-start!
(make-thread
(lambda ()
(ctak (hide count input1) (hide count input2) (hide count input3)))))
(thread-start!
(make-thread
(lambda ()
(ctak (hide count input1) (hide count input2) (hide count input3)))))
(thread-start!
(make-thread
(lambda ()
(ctak (hide count input1) (hide count input2) (hide count input3)))))
(thread-start!
(make-thread
(lambda ()
(ctak (hide count input1) (hide count input2) (hide count input3)))))
(ctak (hide count input1) (hide count input2) (hide count input3))
;; TODO: thread-join
)
(lambda (result) (equal? result output))))) (lambda (result) (equal? result output)))))
;;; The following code is appended to all benchmarks. ;;; The following code is appended to all benchmarks.

View file

@ -1,6 +1,6 @@
;;; PARAFFINS -- Compute how many paraffins exist with N carbon atoms. ;;; PARAFFINS -- Compute how many paraffins exist with N carbon atoms.
(import (scheme base) (scheme read) (scheme write) (scheme time)) (import (scheme base) (scheme read) (scheme write) (scheme time) (srfi 18))
;;; This benchmark uses the following R6RS procedures. ;;; This benchmark uses the following R6RS procedures.
@ -186,7 +186,17 @@
(run-r7rs-benchmark (run-r7rs-benchmark
(string-append name ":" s1 ":" s2) (string-append name ":" s1 ":" s2)
count count
(lambda () (nb (hide count input1))) (lambda ()
#;(thread-start!
(make-thread
(lambda ()
(nb (hide count input1)))))
(thread-start!
(make-thread
(lambda ()
(nb (hide count input1)))))
(nb (hide count input1))
)
(lambda (result) (= result output))))) (lambda (result) (= result output)))))
;;; The following code is appended to all benchmarks. ;;; The following code is appended to all benchmarks.