Browse Source

Update perf-tests to new spawn interface

machines
Christopher Lemmer Webber 7 years ago
parent
commit
e7d3811b77
No known key found for this signature in database
GPG Key ID: 4BC025925FF8F4D3
  1. 18
      misc/perf-tests.rkt

18
misc/perf-tests.rkt

@ -4,7 +4,7 @@
racket/match)
(define (do-actors-gc [actormap (make-whactormap)])
(define (simple-actor bcom)
(define ((simple-actor bcom))
'hello)
(time
(actormap-run!
@ -18,7 +18,7 @@
;; (collect-garbage 'major)
(define (do-self-referential-actors-gc [actormap (make-whactormap)])
(define (make-simple-actor bcom)
(define (^simple-actor bcom)
(define self
(match-lambda*
[(list 'self) self]
@ -30,18 +30,18 @@
(lambda ()
(for ([i 1000000])
(define friend
(spawn (make-simple-actor)))
(spawn ^simple-actor))
(call friend 'oop))))))
(define (call-a-lot [actormap (make-whactormap)])
(define (simple-actor bcom)
(define ((^simple-actor bcom))
'hello)
(time
(actormap-run!
actormap
(lambda ()
(define friend
(spawn simple-actor))
(spawn ^simple-actor))
(for ([i 1000000])
(call friend))))))
@ -49,11 +49,12 @@
(define (bcom-a-lot [actormap (make-whactormap)]
#:num-actors [num-actors 1000]
#:iterations [iterations 1000])
(define ((incrementing-actor [i 0]) bcom)
(bcom (incrementing-actor (add1 i)) i))
(define ((^incrementing-actor bcom [i 0]))
(values (bcom ^incrementing-actor (add1 i))
i))
(define i-as
(for/list ([i num-actors])
(actormap-spawn! actormap (incrementing-actor))))
(actormap-spawn! actormap ^incrementing-actor)))
(time
(for ([_ iterations])
(actormap-run!
@ -61,3 +62,4 @@
(lambda ()
(for ([i-a i-as])
(i-a)))))))

Loading…
Cancel
Save