#lang racket (require prospect/route prospect/tset) (define N-PATTERNS 10000) (define N-MESSAGES 1000000) (define (pat n) (pattern->matcher (datum-tset n) (list n ?))) (define pats (time (for/fold [(p (matcher-empty))] [(n (in-range N-PATTERNS))] (matcher-union p (pat n))))) ;; (display (matcher->dot pats)) (collect-garbage) (collect-garbage) (collect-garbage) (define-values (_result cpu-time delta-ms gc-time) (time-apply (lambda () (for [(j (in-range N-MESSAGES))] (define i (random N-PATTERNS)) (matcher-match-value pats (list i i) #f))) '())) (printf "Delta ~a ms; that is, ~a microsec per routed message, ~a Hz\n" delta-ms (/ (* 1000.0 delta-ms) N-MESSAGES) (/ N-MESSAGES (/ delta-ms 1000.0)))