diff --git a/src/logging/timer.jl b/src/logging/timer.jl index 23372430..b097f963 100644 --- a/src/logging/timer.jl +++ b/src/logging/timer.jl @@ -1,3 +1,8 @@ +# +# very coarse timings logger to allow digging into what is most expensive. +# will probably either be completely removed or replaced by a stand-alone module +# + const TIMER = Vector{NamedTuple{(:depth,:label,:duration), Tuple{Int64,String,Float64}}}() const TIMERN = Ref(0) diff --git a/src/process/config_utils.jl b/src/process/config_utils.jl index 764f2120..84b79ace 100644 --- a/src/process/config_utils.jl +++ b/src/process/config_utils.jl @@ -140,7 +140,7 @@ end # ------------- # """"" - process_utils(utils, gc) + process_utils(gc, utils) Process a utils string into a given global context object. This is always called in a "fresh" GC context (i.e. one where no code has been executed yet). diff --git a/test/_x_perf.jl b/test/_x_perf.jl index f51c5bab..0b7c5c9e 100644 --- a/test/_x_perf.jl +++ b/test/_x_perf.jl @@ -16,7 +16,7 @@ using BenchmarkTools # ==================================== # Time to create a DefaultLocalContext -# as of 29/7/2023 it's around 0.33ms. +# as of 29/7/2023 it's around 0.33ms << 1ms begin u = raw""" import Literate @@ -50,5 +50,32 @@ begin """ gc = X.DefaultGlobalContext() + X.process_utils(gc, u) @btime X.DefaultLocalContext($gc; rpath=randstring(5)); end + + +# ================================================================= +# Time to create a DefaultLocalContext and evaluate a front matter +# with or without a date doesn't change much, it takes around 1.8-2.0ms. +# eval of hfun fill takes negligible time on top of that +begin + u = raw""" + @reexport using Dates + """ + gc = X.DefaultGlobalContext() + X.process_utils(gc, u) + function foo(_gc) + lc = X.DefaultLocalContext(_gc; rpath=randstring(5)) + c = """ + +++ + pub = Date(2023, 8, 15) + title = "hello" + +++ + ABC {{pub}} + """ + html(c, lc) + end + @btime foo($gc); +end +