From 1a441baba29bd1ffc71d81aecc51f93a653197cf Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 13 May 2023 21:38:57 -0400 Subject: graphics: engine: Work around closure allocation issue. --- chickadee/graphics/engine.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chickadee/graphics/engine.scm b/chickadee/graphics/engine.scm index a007c6e..2bc6463 100644 --- a/chickadee/graphics/engine.scm +++ b/chickadee/graphics/engine.scm @@ -287,9 +287,16 @@ (engine (current-graphics-engine))) (hashq-set! (graphics-engine-variables engine) var value)) + +;; HACK: This *should* be in graphics-engine-commit! but for some +;; reason Guile's compiler is generating inefficient bytecode that +;; allocates a closure even though it should be completely +;; unnecessary. Defining this procedure at the top-level fixes it. +(define (maybe-bind _id state) + (graphics-state-bind-maybe state)) + (define (graphics-engine-commit!) - (array-list-for-each (lambda (id state) - (graphics-state-bind-maybe state)) + (array-list-for-each maybe-bind (graphics-engine-states (current-graphics-engine)))) (define* (graphics-engine-guard! obj #:optional -- cgit v1.2.3