Zulip Chat Archive

Stream: lean4

Topic: profiling / timing only the top-level commands?


Jason Gross (Apr 20 2025 at 23:36):

Is there a way to get lean to tell me how long each line takes to run/elaborate (Elab.command), without spending a bunch of time (a) printing the line, and (b) tracing/printing children? I have a file that takes 100x longer to run with the profiler on than with it off.

Aaron Liu (Apr 20 2025 at 23:41):

Maybe #time?

Sebastian Ullrich (Apr 21 2025 at 08:32):

You can set the trace profiler threshold very high but then enable Elab.command specifically

Jason Gross (Apr 21 2025 at 16:01):

Thank you both! Is there a way to set the output format of #time?

Jason Gross (Apr 21 2025 at 17:17):

Actually, @Sebastian Ullrich , if I do

set_option trace.profiler true
set_option trace.profiler.threshold 1000
set_option trace.Elab.command true

then I see the trace for [Elab.command], but I don't see the timing for it. I want to see the profile on everything that's enabled / to disable the trace on everything but Elab.command.

Sebastian Ullrich (Apr 21 2025 at 18:03):

If I open that code in the playground and add another command, I do get timings. Maybe some old Lean version?

Jason Gross (Apr 21 2025 at 18:40):

I'm running Lean (version 4.18.0, arm64-apple-darwin23.6.0, commit 11ccbced7964, Release)

Jason Gross (Apr 21 2025 at 18:46):

But indeed switching to nightly seems to show timings


Last updated: May 02 2025 at 03:31 UTC