Skip to content

Commit 277aa19

Browse files
committed
Use a log-based evaluator for docs.
Actually profiling things when building docs led to very high memory use.
1 parent e949171 commit 277aa19

File tree

2 files changed

+46
-7
lines changed

2 files changed

+46
-7
lines changed

scribblings/contract-profile.scrbl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#lang scribble/doc
22

33
@(require scribble/manual
4-
scribble/eval
4+
scribble/example
5+
racket/runtime-path
56
(for-label racket/base racket/contract))
7+
@(define log-file "./eval-log.txt")
68
@(define contract-profile-eval
7-
(make-base-eval
8-
'(begin (require contract-profile
9-
racket/contract
10-
(only-in racket/file file->string)
11-
racket/list))))
9+
(make-log-based-eval log-file 'replay))
10+
@(contract-profile-eval
11+
'(begin (require contract-profile
12+
racket/contract
13+
(only-in racket/file file->string)
14+
racket/list)))
1215

1316
@title[#:tag "contract-profiling"]{Contract Profiling}
1417

@@ -118,7 +121,7 @@ arguments which specify their destination files. An argument of @racket[#f]
118121
}
119122

120123

121-
@examples[#:eval contract-profile-eval
124+
@examples[#:eval contract-profile-eval #:preserve-source-locations
122125
(define/contract (sum* numbers)
123126
(-> (listof integer?) integer?)
124127
(for/fold ([total 0])
@@ -135,3 +138,5 @@ arguments which specify their destination files. An argument of @racket[#f]
135138

136139
(contract-profile (vector-max* (make-vector 10 (range (expt 10 7)))))
137140
]
141+
142+
@(close-eval contract-profile-eval)

scribblings/eval-log.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
;; This file was created by make-log-based-eval
2+
((begin
3+
(require contract-profile
4+
racket/contract
5+
(only-in racket/file file->string)
6+
racket/list))
7+
((3) 0 () 0 () () (c values c (void)))
8+
#""
9+
#"")
10+
((define/contract
11+
(sum* numbers)
12+
(-> (listof integer?) integer?)
13+
(for/fold ((total 0)) ((n (in-list numbers))) (+ total n)))
14+
((3) 0 () 0 () () (c values c (void)))
15+
#""
16+
#"")
17+
((contract-profile (sum* (range (expt 10 7))))
18+
((3) 0 () 0 () () (q values 49999995000000))
19+
#"Running time is 20.68% contracts\n529/2555 ms\n\n(-> (listof integer?) integer?) 528.5 ms\n#<blame>::-1 \n sum* 528.5 ms\n\n"
20+
#"")
21+
((define/contract
22+
(vector-max* vec-of-numbers)
23+
(-> (vectorof list?) integer?)
24+
(for/fold
25+
((total 0))
26+
((numbers (in-vector vec-of-numbers)))
27+
(+ total (sum* numbers))))
28+
((3) 0 () 0 () () (c values c (void)))
29+
#""
30+
#"")
31+
((contract-profile (vector-max* (make-vector 10 (range (expt 10 7)))))
32+
((3) 0 () 0 () () (q values 499999950000000))
33+
#"Running time is 93.25% contracts\n4453/4775 ms\n\n(-> (vectorof (listof any/c)) integer?) 2055.5 ms\n#<blame>::-1 \n vector-max* 2055.5 ms\n\n(-> (listof integer?) integer?) 2397 ms\n#<blame>::-1 \n sum* 2397 ms\n\n"
34+
#"")

0 commit comments

Comments
 (0)