-
Notifications
You must be signed in to change notification settings - Fork 80
Gtk causes lags in REPL on Windows #325
Comments
Task scheduler issue? ping @vtjnash |
Win32 kernel bug |
is this specific to Gtk.jl or is the task machinery in general broken on Windows? Is there a dedicated issue in the julia issue list? |
Very few people use win32 nowadays. Win64 is fast now. But we might try and see if processor optimizations has benefits on win64. I will try to compile the libraries when I get to it. There is also some workaround for julia itself, but last times I tried the gtk binaries still had issues. |
This is actually still very much an issue on Windows. I've been entirely confused why the REPL experience on Windows seems to degenerate completely in certain situations, and it does just seem to be enough to load Gtk.jl. It would be great if this could be a high priority issue to fix. There are a fair number of packages that load Gtk.jl, so a lot of folks will probably end up with Gtk.jl loaded (as I did), and then the REPL is really, really crappy. |
I can confirm! I had to remove Gtk from my project since it was unbearable... |
@vtjnash could you elaborate what you mean by "Win32 Kernel Bug" above? Gtk.jl once worked fine on windows and now it seems that people have issues. |
GTK may have worked fine on windows at one time, but I have been trying it out now and then since mid 2015 and always gave up. Tests pass most of the time, but there is always some problem or other. I give up easily. GTK didn't make all binaries available for Windows in the past, and GTK.jl didn't test for windows. I'm reluctant to use anything that can't ultimately be used in my line of work, i.e. the Windows world. And I'll never be able to compile anything at work. JuliaGraphics has an Appveyor account, which is used here: That means that Simon or some other full member can add this project, if it's not already there. I suggest some tests that try hard to find errors, including detecting tasks that don't actually exit fully and get garbage collected. And also put those tests in test/optional. Immerse.jl depends on GTK and tested with Appveyor, so this seems possible. |
Are tasks broken in general on Windows? Here's from Windows 64 bit. Doesn't seem broken here.
|
I'm not the expert about multi-processing/multi-threading on Windows, so i might be completely off. As far as we know, julia is using libuv for asynchonous I/O in general, so things like REPL is transported by libuv and abstracted by this from the operating system. Now. Gtk.jl registers the main event loop into a scheduled task on by a julia call to enable parallel work of REPL and event processing at Gtk. Note: most adaptations of GUI toolkits don't do this, they call the main loop and have a means to go back to the control flow - usually when main window is closed. I have not managed to read the libgtk documentation about event processing and multithreading, but as there are more 'hooks' for event processing, i guess there is more to integration of the event loop then just global gtk_main_task = schedule(Task(gtk_main)). P.S. debugging things like this is very, very complicated. |
Lobingera, when you write parallel above, do you mean exactly that? Is gtk in a fully parallel loop? Could that be an alternative if not? |
You could try reducing the delay at from 100 to 10: Line 291 in 4e110ac
|
@hustf Parallel is an abstract concept anyway... |
I'm not sure if I'm on the correct track here, but I think when GTK.jl was first made, there were some fundamental differences with how libuv handled access to the backend file descriptors on Unix and Windows. Actually I think for windows it just didn't handle them at all. See here: libuv/libuv@2e9d86e#diff-0886ba7381a955af32f753d649ba2e29 libuv on Windows now returns an IOCP handle: The current implementation of GTK.jl doesn't attempt to use any of the libuv framework to poll events from the main loop on Windows (I think), and just assigns an infinite timeout that is dealt with later as above with the hard-coded timeout. Line 352 in 6298bd4
Perhaps now we can poll the main event loop on windows as is done on Unix? Alternatively, I think Gtk has a few methods that are older to get around this issue. As a comment in glib states:
https://github.com/GNOME/glib/blob/master/glib/gpoll.c There is pretty limited documentation of this function, but maybe it would accomplish the same goals? Also important: I have absolutely no idea what I'm doing. |
Sorry for asking, but since there have only been mentions of this issue for half a year, is this still being solved? For me because image processing is pretty annoying w/o ImageView. |
In large measure because of this issue I've been meaning to experiment with a browser-port of ImageView, but haven't had time to look into it. A PR (even if very incomplete) based on Observables.jl would be cherished! |
Can confirm on windows 11, REPL slows down as soon as you "using Gtk". Interestingly it also slows down typing in this editbox on github, very strange. I used Visual Studio Code with language server for Julia. Reproducible also with powershell Julia being started and typing "using Gtk". It is about 2 chars per second during typing, so really slow. I wonder a little bit, why this is open since a number of years now. Is it too difficult to fix, is it simply a native GTK/Windows mismatch? I mean I was impressed how the package manager get everything on my system in minutes, this is awesome! Since Windows is the dominating computing platform for desktop by numbers keeping this open for 4.5 years is not encouraging for desktop UI devs, is it? Or is desktop UI app development dead in general? |
Suggested by @jwahlstrand in #629: having |
Is that something that |
Can confirm this bug happens on windows 10 and 11, x64, maybe at least add a warning for windows users? |
Gtk.jl is not maintained anymore. Gtk4.jl is the successor. |
The moment I do
using Gtk
in the REPL on Windows (Tested on 10 and 7 with julia 0.6) the REPL input lags (see screencapture). This doesn't happen (at least for me) on OSX and Linux.The text was updated successfully, but these errors were encountered: