Hi!
I am building a package to create text user interfaces in Julia using ncurses: TextUserInterfaces.jl
Now, I am facing a very, very slow compilation time. For example, the following code just initialize NCurses, create a window with a label, and destroys everything:
using TextUserInterfaces
# Create the TUI.
function test()
# Initialize the TUI.
init_tui("/usr/local/Cellar/ncurses/6.1/lib")
NCurses.noecho()
win = create_window(border = true, title = " WINDOW ",
anchor_left = (rootwin, :left, 0),
anchor_top = (rootwin, :top, 0),
anchor_right = (rootwin, :right, 0),
anchor_bottom = (rootwin, :middle, 0))
create_widget(Val{:label}, win, text = "Top right",
anchor_right = (win, :right, 0),
anchor_top = (win, :top, 0))
refresh_all_windows()
NCurses.update_panels()
NCurses.doupdate()
destroy_tui()
end
test()
Take a look at the difference when I run it for the first and second times:
julia> @time include("teste6.jl")
1.167181 seconds (3.41 M allocations: 172.807 MiB, 3.10% gc time)
julia> @time include("teste6.jl")
0.024663 seconds (19.38 k allocations: 890.259 KiB)
For a very complex TUI, with lots of widgets, this time is almost prohibitive (taking more than 5s to show the TUI). Is there anything I can do to debug/reduce it?
EDIT: Just an additional information, putting the function inside a module did not solve the problem.