Closed bennn closed 1 year ago
We can add (begin-for-syntax (require forge/shared) (do-time "for-syntax WHATEVER"))
at the top of a file, and that'll report a time during macro expansion.
But, if I compile the program first (raco make
), then macros don't expand when I run racket
, and there's still a 1-sec startup cost.
ALSO the logs print several times when compiling and need extra racket/base requires at for-syntax
so I will not add them here
Other news: logger code has no cost if nobody is subscribed to the logger.
Example:
#lang racket/base
(define-logger foo)
(define (f)
(for/fold ((acc '()))
((n (in-range 20000)))
(cons n (reverse acc))))
;; (void (f))
;; 3 seconds
(log-foo-debug "wow ~s" (car (f)))
;; 0.2 seconds if nobody listening to the foo logger
;; time racket file.rkt
;; or even: time PLTSTDERR="error info@foo" racket file.rkt
;; 3 seconds if listeners
;; time PLTSTDERR="error debug@foo" racket file.rkt
add a macro to time things
looks like startup takes 1 second before anything can happen in Forge land
my output for an empty forge/core file: