From f1d821473ffd605d8ecc7527c2f5997e0abec33b Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Mon, 19 Jul 2021 07:27:37 -0400 Subject: [PATCH] Move compile timing to inside `@time`'s main timing block. Fixes >100% compilation time reports (#41286) * ensure `@time`'s inner timing functions are compiled (cherry picked from commit 0dbd3f77d975edcc7e03e167f3f60aca186aff6c) --- base/timing.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base/timing.jl b/base/timing.jl index 7af6f038ba6ea..ab7af23048305 100644 --- a/base/timing.jl +++ b/base/timing.jl @@ -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 @@ -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