Skip to content

Commit 749ff9a

Browse files
committed
Only run Taylor on the last iteration
1 parent 6b657f9 commit 749ff9a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/core/mainloop.rkt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
(for ([iteration (in-range (*num-iterations*))]
6464
#:break (atab-completed? (^table^)))
65-
(run-iteration! global-spec-batch spec-reducer))
65+
(run-iteration! global-spec-batch spec-reducer iteration))
6666
(define alternatives (extract!))
6767
(timeline-event! 'preprocess)
6868
(for/list ([altn alternatives])
@@ -234,14 +234,14 @@
234234
(^patched^ #f)
235235
(void))
236236

237-
(define (run-iteration! global-spec-batch spec-reducer)
237+
(define (run-iteration! global-spec-batch spec-reducer iteration)
238238
(unless (^next-alts^)
239239
(choose-alts!))
240240

241241
(define brfs (map alt-expr (^next-alts^)))
242242
(define brfs* (batch-reachable (*global-batch*) brfs #:condition node-is-impl?))
243243

244-
(reconstruct! (generate-candidates (*global-batch*) brfs* global-spec-batch spec-reducer))
244+
(reconstruct! (generate-candidates (*global-batch*) brfs* global-spec-batch spec-reducer iteration))
245245
(finalize-iter!)
246246
(void))
247247

src/core/patch.rkt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
[(list) (alt-expr altn)]
201201
[(list prev) (get-starting-expr prev)]))
202202

203-
(define (generate-candidates batch brfs spec-batch reducer)
203+
(define (generate-candidates batch brfs spec-batch reducer iteration)
204204
; Starting alternatives
205205
(define start-altns
206206
(for/list ([brf brfs])
@@ -213,7 +213,8 @@
213213

214214
; Series expand
215215
(define approximations
216-
(if (flag-set? 'generate 'taylor)
216+
(if (and (flag-set? 'generate 'taylor)
217+
(>= iteration (- (*num-iterations*) 1)))
217218
(run-taylor start-altns batch spec-batch reducer)
218219
'()))
219220

0 commit comments

Comments
 (0)