Term.jl icon indicating copy to clipboard operation
Term.jl copied to clipboard

Lower TTFX(Time to first X) time by shifting more things to precompilation

Open VarLad opened this issue 1 year ago • 6 comments

Hello. Thanks for the awesome project. I've been using it for a while and I was wondering if one can do something about TTFX times for REPR, Errors and Logs. More specifically, I wonder if we can shift more things to precompilation via a new package which got released recently https://discourse.julialang.org/t/ann-new-package-snoopprecompile/84778

VarLad avatar Aug 10 '22 22:08 VarLad

Hey thanks for suggesting that.

I've added

using SnoopPrecompile

@precompile_setup begin
    @precompile_all_calls begin
        Panel()
        Panel("test") * Panel(Panel()) / hLine(20)
    end
end

julia> @time using Term
[ Info: Precompiling Term [22787eb5-b846-44ae-b979-8e399b8463ab]
  6.172189 seconds (2.07 M allocations: 114.463 MiB, 0.63% gc time, 8.67% compilation time: 99% of which was recompilation)

to Term.jl and it increased the compilation time from 0.2 to 6 seconds (on my machine), but then:

julia> @time Panel()
  1.646217 seconds (3.80 M allocations: 204.119 MiB, 13.22% gc time, 99.90% compilation time: 3% of which was recompilation)

I think I don't understand how to use pre-compilation directly, any pointers?

FedeClaudi avatar Aug 23 '22 12:08 FedeClaudi

@FedeClaudi Hey. Thats odd. Can I open a topic on Zulip for this? People there are much better at troubleshooting this stuff

Also, is that on Julia 1.8?

VarLad avatar Aug 23 '22 12:08 VarLad

yeah of course that'd be great. Yeah I tried on Julia1.8

FedeClaudi avatar Aug 23 '22 13:08 FedeClaudi

@FedeClaudi It would also be helpful if there was a branch or a PR I could try to troubleshoot this :sweat_smile:

VarLad avatar Aug 23 '22 13:08 VarLad

Hi,

You can just try adding

using SnoopPrecompile

@precompile_setup begin
    @precompile_all_calls begin
        Panel()
        Panel("test") * Panel(Panel()) / hLine(20)
    end
end

to Term.jl, this is all I've tried so far

FedeClaudi avatar Aug 23 '22 13:08 FedeClaudi

image Here's what I see.

VarLad avatar Aug 23 '22 13:08 VarLad

@FedeClaudi That reminds me, here's the link to the Zulip topic. There's some constructive feedback in there as well. https://julialang.zulipchat.com/#narrow/stream/225542-helpdesk/topic/Lowering.20TTFX.20in.20Term.2Ejl

VarLad avatar Aug 25 '22 18:08 VarLad