adjust datum-intern stress test

Instead of requiring a table not to grow within an iteration, require
it to not grow across iterations.
This commit is contained in:
Matthew Flatt 2020-06-04 11:15:50 -06:00
parent 0938ae8e33
commit 3cc74bd3db

View File

@ -1,19 +1,25 @@
#lang racket/base
(define (check label mk)
(let loop ([tries 0])
(printf "~a ~a\n" label tries)
(collect-garbage)
(define pre (current-memory-use))
(collect-garbage)
(define pre (current-memory-use))
(let loop ([tries 0] [pre pre])
(printf "~a ~a @ ~s\n" label tries pre)
(for ([j 100])
(for ([i (in-range 10000)])
(datum-intern-literal (mk i j))))
(collect-garbage)
(when ((current-memory-use) . > . pre)
(when (= tries 10)
(define post (current-memory-use))
(when (post . > . pre)
(when (= tries 20)
(error 'check "didn't find non-growing iteration"))
(loop (add1 tries)))))
(loop (add1 tries) post))))
(pseudo-random-generator->vector (current-pseudo-random-generator))
(check "strings" (lambda (i j) (format "string-~a-~a" i j)))
(check "flonums" (lambda (i j) (random)))
(module+ test
(module config info
(define random? #t)))