Julia causing latency?

I have used Julia for several years, love it.

I recently installed Julia 1.7.2 on a new Windows machine. After running some code in the REPL (to rule out VSCode being at fault), I am getting significant latency for all computer functions, including those not involving julia. E.g. I type some words into my browser or into windows explorer and wait… the characters appear one at a time, 1-2 seconds apart. Task manager indicates I am currently using 1-3% of CPU and 50% of memory. If I close the REPL, the latency goes away. I have recently restarted the computer, that is not the problem. I had had problems with this sort of latency sporadically in the past on my older machine (with a worse CPU), but most recently have not been having this problem. I am suspicious that antivirus software installed by my employer may have caused this problem in the past, but I do not see evidence in the task manager that antivirus software is using unusually high resources when the Julia REPL is up.

Are there any thoughts on what might be causing this? I do not even know where to begin with troubleshooting this. Are there packages known to cause this sort of problem?

The source of the problem appears to be the ProfileView.jl package. typing “using ProfileView” causes the latency issue; when I comment out this package I no longer have problems.

It appears to be a problem specific to the package, but it seems strange that a package could do this when cpu usage is virtually zero and RAM is not close to being maxed out.

1 Like

Yes, it’s likely coming from Gtk.jl:

I’ve heard of Gtk.jl causing Julia code to run slow and making the REPL laggy, but slowing down all other apps? How does that work?

It looks like this is related to a recent change to help Gtk.jl not interfere with multithreading. If you’re not doing stuff related to threads, you could try setting an environmental variable GTK_AUTO_IDLE=false. That fixes this lag for me. I hadn’t noticed it until now as I don’t use Julia+Gtk on Windows much.

1 Like