Skip to content

Commit 89638fb

Browse files
committed
Make examples more reliable.
1 parent bcf6435 commit 89638fb

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

scribblings/contract-profile.scrbl

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,13 @@ arguments which specify their destination files. An argument of @racket[#f]
118118
([n (in-list numbers)])
119119
(+ total n)))
120120

121-
(contract-profile (sum* (range (expt 10 6))))
122-
]
123-
124-
The example shows that a large proportion of the call to @racket[sum*]
125-
with a list of 1 million integers is spent validating the input list.
126-
121+
(contract-profile (sum* (range (expt 10 7))))
127122

128-
Note that the contract profiler is unlikely to detect fast-running contracts
129-
that trigger other, slower contract checks.
130-
In the following example, there is a higher chance that the profiler
131-
samples a @racket[(listof integer?)] contract than the underlying
132-
@racket[(vectorof list?)] contract.
133-
134-
@examples[#:eval contract-profile-eval
135123
(define/contract (vector-max* vec-of-numbers)
136124
(-> (vectorof list?) integer?)
137125
(for/fold ([total 0])
138126
([numbers (in-vector vec-of-numbers)])
139127
(+ total (sum* numbers))))
140128

141-
(contract-profile (vector-max* (make-vector 10 (range (expt 10 6)))))
129+
(contract-profile (vector-max* (make-vector 10 (range (expt 10 7)))))
142130
]

0 commit comments

Comments
 (0)