Skip to content

Commit f0e039f

Browse files
committed
GLCORE: Optimization: add compile~/runtime separation
Profiling indicates that the logging overhead may be eccessive.
1 parent d8dc5ec commit f0e039f

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

modules/ln_glcore/glcore.scm

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3737
|#
3838
;; Absolutely minimal OpenGL (ES) interface
3939

40-
(define glcore:debuglevel 0)
41-
(define (glcore:log level . x)
42-
(if (>= glcore:debuglevel level) (apply log-system (append (list "glcore: " x)))))
40+
;;* Compiletime
41+
42+
#| ;; enable manually in source
43+
(define-cond-expand-feature profile)
44+
;;|#
45+
46+
(cond-expand
47+
(debug
48+
(define glcore:debuglevel 0)
49+
(define (glcore:log level . x)
50+
(if (>= glcore:debuglevel level) (apply log-system (append (list "glcore: " x))))))
51+
(else))
52+
53+
(cond-expand
54+
(profile ;; ignore even when otherwise in `debug` mode
55+
(define-macro (glcore:log . ignored) #!void))
56+
(debug) ;; defined by previous `debug` expansion
57+
(else (define-macro (glcore:log . ignored) #!void)))
58+
59+
;;* Runtime
4360

4461
;; ----------------------------------
4562
;; Initialization

0 commit comments

Comments
 (0)