Adapt routingspeed.rkt to Syndicate

This commit is contained in:
Tony Garnock-Jones 2017-05-14 16:04:59 -04:00
parent 3e611d190c
commit 015ba5f60a

View file

@ -1,15 +1,17 @@
#lang racket
(require prospect/route prospect/tset)
(require syndicate/trie syndicate/tset)
(define N-PATTERNS 10000)
(define N-MESSAGES 1000000)
(define (pat n) (pattern->trie (datum-tset n) (list n ?)))
(struct tuple (a b) #:prefab)
(define (pat n) (pattern->trie (datum-tset n) (tuple n ?)))
(define pats
(time
(for/fold [(p (trie-empty))]
(for/fold [(p trie-empty)]
[(n (in-range N-PATTERNS))]
(trie-union p (pat n)))))
@ -24,7 +26,7 @@
(lambda ()
(for [(j (in-range N-MESSAGES))]
(define i (random N-PATTERNS))
(trie-lookup pats (list i i) #f)))
(trie-lookup pats (tuple i i) #f)))
'()))
(printf "Delta ~a ms; that is, ~a microsec per routed message, ~a Hz\n"