From 35b952b101bf42f63bfbdddf438bd7597c20a629 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 27 Nov 2018 13:35:19 -0800 Subject: [PATCH] cachier --- quad/quad/typewriter-test.rkt | 2 +- quad/quad/typewriter.rkt | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/quad/quad/typewriter-test.rkt b/quad/quad/typewriter-test.rkt index 17d5425e..d3be045e 100644 --- a/quad/quad/typewriter-test.rkt +++ b/quad/quad/typewriter-test.rkt @@ -1,3 +1,3 @@ -#lang quad/typewriter 32 +#lang quad/typewriter 8 ◊quad[#:fontsize "11"]{Get Ready ◊quad[#:link "http://beautifulracket.com"]{An expression that} is not a value can ◊quad[#:fontsize "22"]{always} ◊quad[#:fontsize "7"]{be partitioned} into two parts: a redex, which is the part that changed in a single-step simplification (highlighted), and the continuation, which is the evaluation context surrounding an expression. In (- 4 (+ 1 1)), the redex is (+ 1 1), and the continuation is (- 4 []), where [] takes the place of the redex. That is, the continuation says how to "continue" after the redex is reduced to a value. ◊quad[#:link "http://beautifulracket.com"]{An expression that} is not a value can ◊quad[#:fontsize "22"]{always} ◊quad[#:fontsize "7"]{be partitioned} into two parts: a redex, which is the part that changed in a single-step simplification (highlighted), and the continuation, which is the evaluation context surrounding an expression. In (- 4 (+ 1 1)), the redex is (+ 1 1), and the continuation is (- 4 []), where [] takes the place of the redex. That is, the continuation says how to "continue" after the redex is reduced to a value. ◊quad[#:link "http://beautifulracket.com"]{An expression that} is not a value can ◊quad[#:fontsize "22"]{always} ◊quad[#:fontsize "7"]{be partitioned} into two parts: a redex, which is the part that changed in a single-step simplification (highlighted), and the continuation, which is the evaluation context surrounding an expression. In (- 4 (+ 1 1)), the redex is (+ 1 1), and the continuation is (- 4 []), where [] takes the place of the redex. That is, the continuation says how to "continue" after the redex is reduced to a value.} diff --git a/quad/quad/typewriter.rkt b/quad/quad/typewriter.rkt index 181f9e86..12393750 100644 --- a/quad/quad/typewriter.rkt +++ b/quad/quad/typewriter.rkt @@ -126,7 +126,6 @@ #:finish-wrap-proc (λ (pcs) (list ($page (hasheq 'offset '(36 36)) (filter-not $break? pcs)))))) (define (typeset qarg) - (current-layout-caching #true) ; from fontland/font (define chars 65) (define line-width (* 7.2 chars)) (define lines-per-page (* 40 line-height)) @@ -152,11 +151,13 @@ [pipe (open-output-file path #:exists 'replace)] [font (path->string charter)] [fontSize 12])) - (define q (typeset qin)) - (report draw-counter) - (time-name draw (draw q doc)) - (report draw-counter) - (time-name end-doc (send doc end)))) + ;; 181127: with layout caching, draw takes about 1.5x linebreak; without, about 2x + (parameterize ([current-layout-caching #true]) ; from fontland/font + (define q (typeset qin)) + (report draw-counter) + (time-name draw (draw q doc)) + (report draw-counter) + (time-name end-doc (send doc end))))) (define-macro (mb . ARGS) (with-syntax ([PS (syntax-property #'ARGS 'ps)]