Question about compilation time of the whole language

Hello everyone, I was trying in these days for the first time to work on julia internals. I havea a question about the time it takes to compile the whole language. So my usual workflow is: modify some code, compile the language by running the “make” command in the julia folder. But compiling the whole language takes up to 5 minutes every time (I have a m1 macbook air), even for the smallest modification. Is there a different way to do this that is faster?

Depends on which part of the codebase you’re working on.

If you’re doing a minor modification in the C codebase, then just doing make -C src -j might do the trick – the -C src ensures you only recompile the C codebase (and don’t recompile Base/Core itself) and the -j enables multiple workers to compile your code.

If you’re working in Base or other pure-Julia part of the codebase, Revise should enable you to only trigger the recompilation of whatever method you modified.

4 Likes

How far can this go? Is it really generally possible to not have to rebuild the Base system image afterward?

Revise.jl does inform users but it does have limitations. Interactively modifying methods goes pretty far in practice, but depending on how things are executed, an interactive modification may not have the same effect as restarting the session with the modification, and Revise can’t do interactive changes that Julia can’t e.g. const assignments.

:thinking:

1 Like

Depends on exactly what you’re changing. If you’re changing anything that affects the ABI or memory layout, you’ll likely need to rebuild everything. That’s somewhat rare though.

1 Like

how can i do that? i have seen from online documentation that revise can help me edit code of external packages. If i want to use it to edit the julia source code how do i do it? I tried calling

edit(showerror)

because i am working on the showerror function in the base/errorshow.jl file, but It doenst work

showerror is part of Base:

julia> parentmodule(showerror)
Base

therefore you can do Revise.track(Base) to track and recompile in your changes to it.

3 Likes

mentioned in docs here btw Home · Revise.jl

2 Likes