Skip to content

Commit

Permalink
Move compile timing to inside @time's main timing block. Fixes >100…
Browse files Browse the repository at this point in the history
…% compilation time reports (#41286)

* ensure `@time`'s inner timing functions are compiled

(cherry picked from commit 0dbd3f7)
  • Loading branch information
IanButterworth authored and KristofferC committed Jul 26, 2021
1 parent 903ae5a commit 98b5e41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/timing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ macro time(ex)
quote
while false; end # compiler heuristic: compile this block (alter this if the heuristic changes)
local stats = gc_num()
local compile_elapsedtime = cumulative_compile_time_ns_before()
local elapsedtime = time_ns()
local compile_elapsedtime = cumulative_compile_time_ns_before()
local val = $(esc(ex))
elapsedtime = time_ns() - elapsedtime
compile_elapsedtime = cumulative_compile_time_ns_after() - compile_elapsedtime
elapsedtime = time_ns() - elapsedtime
local diff = GC_Diff(gc_num(), stats)
time_print(elapsedtime, diff.allocd, diff.total_time, gc_alloc_count(diff), compile_elapsedtime, true)
val
Expand Down Expand Up @@ -251,11 +251,11 @@ macro timev(ex)
quote
while false; end # compiler heuristic: compile this block (alter this if the heuristic changes)
local stats = gc_num()
local compile_elapsedtime = cumulative_compile_time_ns_before()
local elapsedtime = time_ns()
local compile_elapsedtime = cumulative_compile_time_ns_before()
local val = $(esc(ex))
elapsedtime = time_ns() - elapsedtime
compile_elapsedtime = cumulative_compile_time_ns_after() - compile_elapsedtime
elapsedtime = time_ns() - elapsedtime
local diff = GC_Diff(gc_num(), stats)
timev_print(elapsedtime, diff, compile_elapsedtime)
val
Expand Down

0 comments on commit 98b5e41

Please sign in to comment.