diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-05-13 21:38:57 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-05-13 21:38:57 -0400 |
commit | 1a441baba29bd1ffc71d81aecc51f93a653197cf (patch) | |
tree | aea6a149229f79002d61184bfa7f2b0e471747ef | |
parent | 3b859f9170f7f7377cb085a587aa21d86015be74 (diff) |
graphics: engine: Work around closure allocation issue.
-rw-r--r-- | chickadee/graphics/engine.scm | 11 |
1 files 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 |