1. GUI App vs CLI App - Speed
- Posted by euphoric (admin) May 06, 2019
- 2076 views
Is the speed of a CLI app going to always be faster than a GUI app?
I'm guessing that general functionality won't be any slower on a GUI app, but will the output to a console always be faster than output to a GUI?
Asked because of this article.
2. Re: GUI App vs CLI App - Speed
- Posted by ghaberek (admin) May 06, 2019
- 2025 views
GUI applications generally have a lot going on behind the scenes: message loop, event passing, object hierarchy, widget drawing, etc. But CLI apps are generally pretty straight-forward: you get it, do your business, and get out. One thing I've noticed though, is that writing a lot of output from a CLI app will slow it down, at least on Windows. A lot of my various data-processing scripts in Euphoria run much faster when they're not writing to the console. (This could also be due to the way Euphoria handles the console on Windows.)
-Greg
3. Re: GUI App vs CLI App - Speed
- Posted by irv May 06, 2019
- 2050 views
"it marks Microsoft’s latest efforts to improve the developer environment on Windows 10."
It's still got a long way to go. But at least Windows now has a usable pseudo-terminal, and you can even download and install Ubuntu right from Microsoft.
Free, even! (give 'em time, they'll figure out how to charge for it.)
As for speed - the Windows terminals - both old and this new one, just like Linux terminals when you're running a window manager, are just emulating a cli. So they are doing a lot of graphic work anyway.
Um... I have an idea - why not just install Linux in the first place? Then you can open an actual full-screen cli. Is that even possible on Windows?
4. Re: GUI App vs CLI App - Speed
- Posted by irv May 25, 2019
- 1473 views
- Last edited May 26, 2019
I'm guessing that general functionality won't be any slower on a GUI app, but will the output to a console always be faster than output to a GUI?
So... some testing was warranted - the idea being to determine the speed at which you can display a significant amount of text on the screen/terminal/window.
ifdef WINDOWS then object thefile = "C:/Users/Irv/demos/GtkEngine.e" elsedef object thefile = "/home/irv/demos/GtkEngine.e" end ifdef -- largest text file I had handy -- 10,606 lines atom fn = open(thefile,"r") object line atom start = time() while 1 do line = gets(fn) if atom(line) then exit end if puts(1,line) end while puts(1,"\n") ? time()-start
The above, of course, just reads lines and displays them on the terminal, one after the other. The terminals scroll upward as lines are added.
Linux (Ubuntu or Mint) | Windows 10 |
---|---|
Gnome terminal: 0.089 sec | cmd.exe 6.34 sec * (see note) |
xterm: 0.0800 sec | legacy terminal 4.04 sec * (see note) |
EuGTK in Textview with scrolling 2.5 sec | EuGTK in Textview with scrolling 7.79 sec |
EuGTK in Textview without scrolling .02 - .03 | EuGTK in Textview without scrolling .03 sec |
So, there's the short answer to your question re: will the output to a console always be faster? Certainly not "always", more like "seldom" to "never", depending upon the platform.
Notes:
- Times are from hitting enter either from the Gnome term or from cmd.exe
- EuGTK times are from clicking on a button to execute the specified load function
- Linux, time to load EuGTK is 0.39 sec. time to load and display text file is 0.02 sec.
- Windows, time to load EuGTK is 0.969, and time to load and display the text is 0.031.
- Windows
- Euiw seems to use what MS calls the "legacy terminal" when running by clicking on a file.
- cmd.exe has an option to use that as well. It is a bit faster.
- On subsequent runs with the same input file, Windows can improve the speed somewhat.
EuGTK program follows which can either match the behavior of the terminals by scrolling as lines are added, or just load and scroll manually later. This makes a difference in speed, of course. Without scrolling (which is of dubious use in this test, all you can do is watch it go by too fast to read):
atom startup = time() include GtkEngine.e include GtkEvents.e include std/io.e ifdef WINDOWS then object thefile = "C:/Users/Irv/demos/GtkEngine.e" elsedef object thefile = "/home/irv/demos/GtkEngine.e" end ifdef constant win = create(GtkWindow,"size=600x600,border=10,$destroy=Quit"), pan = create(GtkBox,"orientation=vertical,spacing=10"), scr = create(GtkScrolledWindow), adj = get(scr,"vadjustment"), txv = create(GtkTextView), buf = get(txv,"buffer"), box = create(GtkButtonBox), btn1 = create(GtkButton,"gtk-ok#NoScroll","NoScroll"), btn2 = create(GtkButton,"gtk-ok#Scroll","Scroll") add(win,pan) pack(pan,scr,1,1) add(scr,txv) pack(pan,-box) add(box,{btn1,btn2}) show_all(win) startup = time()-startup -- save the EuGTK load time main() -------------------------- global function NoScroll() -------------------------- set(buf,"text","") -- clear buffer atom start = time() set(buf,"text",read_file(thefile)) start = time()-start Info(,"Elapsed Time",sprintf("%g seconds",start),sprintf("%g startup",startup)) return 1 end function ------------------------ global function Scroll() ------------------------ set(buf,"text","") -- clear buffer atom fn = open(thefile,"r") object line atom start = time() while 1 do while events:pending() do main_iteration() -- allow gui to update if necessary end while line = gets(fn) if atom(line) then exit end if set(buf,"insert at cursor",line,length(line)) set(adj,"value",get(adj,"upper")) -- scroll to end end while start = time()-start Info(,"Elapsed Time",sprintf("%g seconds",start),sprintf("%g startup",startup)) return 1 end function
Using ctl-alt-F4 brings up a bare-screen mode on Linux, which runs the first test in 1.24 sec. so it's a pseudo-text mode, I guess. Not very useful.
It's possible to boot Linux into bare command-line mode, which should be very fast. Frankly, I couldn't get much done if everything had to be done by command-line, so wouldn't use this. The built-in Gnome terminal is plenty fast enough.
I can't find a way to boot Windows 10 to a bare text command-line mode. Is it possible?
Therefore, since getting a "real" terminal is difficult or impossible unless you're running a specialized application on Linux, then a Linux terminal is by far the fastest. If you have to work with Windows 10, then making your own terminal with EuGTK is faster, not to mention better looking, than Windows' own terminal.