From bf3f86a2b0b70fd9c5f2012e4dbaad47b640aab1 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Thu, 1 Oct 2015 17:41:31 -0400 Subject: [PATCH] Add a performance test for function contracts --- .../performance/function-contract.rkt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 typed-racket-test/performance/function-contract.rkt diff --git a/typed-racket-test/performance/function-contract.rkt b/typed-racket-test/performance/function-contract.rkt new file mode 100644 index 00000000..ce71d493 --- /dev/null +++ b/typed-racket-test/performance/function-contract.rkt @@ -0,0 +1,20 @@ +#lang racket/base + +;; Performance test for generated contracts. This exists to measure +;; whether contract generation interferes with contract +;; system optimizations. + +(module server typed/racket/base + (: f (Integer -> Integer)) + (provide f) + (define (f x) x)) + +(require (submod "." server)) + +(time + (for ([x (in-range 100000)]) + (f 1) (f 2) (f 3) (f 4) (f 5) + (f 1) (f 2) (f 3) (f 4) (f 5) + (f 1) (f 2) (f 3) (f 4) (f 5) + (f 1) (f 2) (f 3) (f 4) (f 5) + (f 1) (f 2) (f 3) (f 4) (f 5)))