Recent

Author Topic: [Solved] can't explain, not the Who, but console/terminal performance  (Read 1412 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 16199
  • Censorship about opinions does not belong here.
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #15 on: November 06, 2024, 02:17:08 pm »
 :o :D cat among the pigeons was not my intend... :-X

https://www.youtube.com/watch?v=voMja9C-coI

Tnx!
« Last Edit: November 06, 2024, 02:22:35 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

440bx

  • Hero Member
  • *****
  • Posts: 4750
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #16 on: November 06, 2024, 03:07:45 pm »
Here are my findings using Win 10.

The test consisted of doing a "dir c:\windows\system32\*.*" which, in Win 10 is a fair number of files.

conhost.exe in Win 10 is noticeably faster than the Win 7 version.  I tested both, the legacy mode and "non-legacy" mode.  The difference, if any, wasn't noticeable.

Just for fun, I compared the output speed of Powershell to TCCLE's.  TCCLE was, at _least_ twice as fast as Powershell (honestly, it felt more than 4 times faster.)

Conclusion: on Win 7, conhost.exe and/or process switching is a dog.  on Win 10, conhost.exe is quite a bit faster.  TCCLE may not have all of Powershell's bells and whistles but, speed-wise, it leaves it in the dust (there simply is no comparison.)

Also, pure GUI output of roughly the same amount of text is basically instantaneous which means that in spite of the improvements to conhost.exe (and possibly process switching) in Win 10, it is still _much_ slower than graphical output by several orders of magnitud (no comparison.)

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 16199
  • Censorship about opinions does not belong here.
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #17 on: November 06, 2024, 06:29:07 pm »
I am only using 10 and 11..
If I smell bad code it usually is bad code and that includes my own code.

440bx

  • Hero Member
  • *****
  • Posts: 4750
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #18 on: November 06, 2024, 06:59:16 pm »
I am only using 10 and 11..
I can't say anything about Win 11 because I am yet to use it but, everything I said in past posts applies to Win 10.  MS improved conhost.exe in Win 10 but, it's still suffers from all the problems it suffered in previous versions because all communications is still across processes.

It _might_ be as much as twice as fast in Win 10 but, that's still slow.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 16199
  • Censorship about opinions does not belong here.
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #19 on: November 08, 2024, 10:02:55 am »
Finally tested powershell and is indeed much faster. It is still a factor three slower than a linux shell, but much better and unlike a 2000% difference.
If I smell bad code it usually is bad code and that includes my own code.

tetrastes

  • Hero Member
  • *****
  • Posts: 600
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #20 on: November 08, 2024, 12:26:06 pm »
It's strange, but I don't see difference between cmd and powershell, I get from 93 to 125 for both:

rvk

  • Hero Member
  • *****
  • Posts: 6591
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #21 on: November 08, 2024, 01:46:48 pm »
It's strange, but I don't see difference between cmd and powershell, I get from 93 to 125 for both:
Is that under Windows 11?
Does that cmd.exe run under conhost.exe because that result for cmd.exe is much faster than here (over 1023).

tetrastes

  • Hero Member
  • *****
  • Posts: 600
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #22 on: November 08, 2024, 01:49:49 pm »
This is under Windows 10.

rvk

  • Hero Member
  • *****
  • Posts: 6591
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #23 on: November 08, 2024, 01:58:25 pm »
This is under Windows 10.
What program is that upper one (the black screen)?
My Russian (?) isn't that good  ;)

Is that really the cmd.exe ?
Then there might be some setting which can make it faster.

tetrastes

  • Hero Member
  • *****
  • Posts: 600
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #24 on: November 08, 2024, 02:20:40 pm »
This is really cmd.exe.
I have noted that it depends on how many lines are output, which depends on the size of screen buffer, size of console window, and using cls command:D

Thaddy

  • Hero Member
  • *****
  • Posts: 16199
  • Censorship about opinions does not belong here.
Re: [Solved] can't explain, not the Who, but console/terminal performance
« Reply #25 on: November 08, 2024, 02:27:46 pm »
Yes, I knew from the start it depends on the output window, but Windows is still slow, be it ps,cmd even last win 11 is slower on the same machine as ubuntu running in wsl2 (hyperv'd). I closed it because it is not a Freepascal issue.
If I smell bad code it usually is bad code and that includes my own code.

LV

  • Full Member
  • ***
  • Posts: 157
Re: can't explain, not the Who, but console/terminal performance
« Reply #26 on: November 08, 2024, 02:35:29 pm »
As I wrote, you can remove all the sync, same behavior.

Code: Pascal  [Select][+][-]
  1. program project1;
  2. uses {$ifdef unix}cthreads,{$endif}sysutils,classes;
  3. var
  4.   start: int64;
  5.   i: integer;
  6.  
  7. begin
  8.   start := gettickcount64;
  9.   writeln('Program start time saved');
  10.   for i := 0 to 100000 do if i mod 100 = 0 then
  11.   begin
  12.     writeln(i);
  13.   end;
  14.   writeln('perform main workload');
  15.   writeln('Main workload finished', ' took: ', gettickcount64 - start);
  16.   readln;
  17. end.    
  18.  

Windows 11. See screenshot.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5764
  • Compiler Developer
Re: can't explain, not the Who, but console/terminal performance
« Reply #27 on: November 09, 2024, 03:26:47 pm »
There might be other reasons but, the process switch alone, required for every write will have a very noticeable performance penalty.

A process switch alone isn't a complete reason for performance issuse. Our operating system at work is a micro kernel and thus all drivers as well as the graphic system, the shell and the terminal run in separate processes. We don't have any real performance issues with shell output at least not as bad as on (older) Windows despite there being quite a lot of task switches involved to output something to the screen.

 

TinyPortal © 2005-2018