Gtk4.jl
Gtk4.jl copied to clipboard
Load Times and TTFX
This issue is meant to track load times and TTFX (time to first X). On my Mac (M1 Max, Intel binaries) I get:
julia> @time using Gtk
0.924702 seconds (2.26 M allocations: 126.467 MiB, 2.75% gc time, 33.69% compilation time)
julia> @time using Gtk4
1.404390 seconds (3.29 M allocations: 180.272 MiB, 3.13% gc time, 47.39% compilation time)
which is already pretty close. TTFX is also slower but I have not properly timed it yet. This issue is certainly not urgent but we should contact people with experience of optimizing load times (-> @timholy :-) ) before doing the switch.
The time for using
(which on my Linux laptop is 0.5 s for Gtk4 vs. 0.46 s for Gtk) might be affected by the large number of autogenerated methods in src/gen
. I noticed that as I added methods, that load time got slower. We could consider splitting off some of the less-used functionality into optional modules. This could include 90% of the gio_methods (many of which overlap functionality built into Julia), graphene methods and gsk4 methods (which will only be useful for fancy custom widgets).
For TTFX, note that there are currently no precompile statements. We could copy what's in Gtk and see how things change.
If Gtk4 has larger coverage, longer load times are actually justified. The numbers are quite good IMHO and we should first focus on stability.
Good to know about TTFX!