Hi, I’m completely new to Julia, from a mostly C++ background, and am very intrigued by it. I’m trying to embed Julia into C++ for a gaming application.
I copied and pasted the code in the docs (Embedding Julia · The Julia Language) using MSVC in Windows 10. I had a few errors like “No Target Architecture” and then jl_atomic_load_relaxed not found. When I got through those by googling for answers, I hit a problem that I don’t see an answer for.
int main(int argc, char** argv)
{
jl_init(); // required init
jl_eval_string("print(sqrt(2.0))"); // run from string
jl_atexit_hook(0); // requred exit
return 0;
}
The jl_init() line takes about 20 seconds every single time I run the app. Any idea what would be happening or how would I remedy it?
I have the environment variable JULIA_DIR set as well as the bin directory in the windows Path. I tried jl_init_with_image but got the same results. startup.jl is empty.
I’m running on a decent laptop i7-8750H with 32GB. I installed Julia on a local SSD where I run all my programming stuff and some high-performance games without issue; although not at the default location Julia suggested in the setup wizard. I’m on Julia version 1.6.2 64bit. I’m using visual studio 2019 v142.
I saw this post: Slow start up and package loading times - #7 by albertoguiggiani which also reported ~20 seconds to startup, but unfortunately it didn’t help narrow my problem down.
I tried grabbing latest binary again and letting it install in the default location on my C drive (an M.2 SSD), but got the same results. I also tried Julia 1.7.0beta4 64bit and had the same results.
Launching Julia.exe from a command prompt runs pretty much instantly.
I’ll be happy to debug this with anyone’s help in order to make Julia more beginner friendly for windows people like me.
IMPORTANT UPDATE: if I run the executable from the command line (>x64\embeddedjulia.exe), it runs fast; or hitting Ctrl+F5 in VS. It’s only super slow when running it using Visual Studio with F5 or “Start Debugging”. This indicates it might be symbol loading. I disabled loading symbols and it still happened. I can see the program stalling loading dlls though. Why is dll loading slower while debugging is the question.
UPDATE2: disabling Tools > Options > Debugging > General “Load debug symbols in external process” made the stall go from 21 seconds to about 12.