terminal icon indicating copy to clipboard operation
terminal copied to clipboard

cmd execution and GCC compilation scripts slow

Open kjarvel opened this issue 6 years ago • 7 comments

Configuration

  • CPU: Intel Core i5-4590 @ 3.30 GHz
  • Windows 7 Anti-Virus: Microsoft Security Essentials
  • Windows 10 Anti-Virus: Microsoft Windows Defender
  • Display 1920 x 1080, Scaling 100%
  • GCC Arm compiler gcc-arm-none-eabi-8-2018-q4-major-win32-sha2.exe from https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads

Windows build number:

  • Windows 7 SP1: Microsoft Windows [Version 6.1.7601]
  • Windows 10 1809: Microsoft Windows [Version 10.0.17763.253]

What you're doing and what's happening:

With Windows 7, executing build_gcc.bat (1000 x gcc-arm-none-eabi) in Command Prompt takes 0:46. With Windows 10, the same script takes +78% longer time with default settings (01:22).

With Windows 7, executing build_cmd.bat (1000 x cmd.exe x 20) in Command Prompt takes 01:48. With Windows 10, the same script takes +139% longer time with default settings (04:18).

Some observations: With Windows 10, some computers show heavy (25-40%) GPU load when Command Prompt is scrolling. A Windows 7 Virtual Machine running build_cmd.bat in Virtual Box on a Windows 10 host outperforms the Windows 10 host.

The strange thing is that starting Command Prompt with "Run as Administrator" on Windows 10 increases performance a lot - back to Windows 7 level. Using the "Legacy Console mode" checkbox only seems to have a minor effect.

See attached scripts and results.txt. scripts.zip results.txt

What's wrong / what should be happening instead:

Windows 10 Command Prompt performance for build_cmd.bat and build_gcc.batshould be the same as with Windows 7, or at least the same as Windows 10 Command Prompt running as Administrator.

(The problem is that running a 10 minute build script might take 20+ minutes on Windows 10)

kjarvel avatar Feb 06 '19 13:02 kjarvel

Update one year later:

  • CPU: Intel Core i5-4590 @ 3.30 GHz
  • Windows 7 SP1: Microsoft Windows [Version 6.1.7601]
  • Windows 10 1909: Microsoft Windows [Version 10.0.18363.836]

build_cmd.bat

  • Windows 7, Command Prompt = 01:34
  • Windows 10, Command Prompt = 02:47
  • Windows 10, Windows Terminal Version 1.0.1401.0 = 02:36

kjarvel avatar Jun 09 '20 11:06 kjarvel

did you try disabling windows defender real time protection to measure the performance?

LuanVSO avatar Aug 31 '20 01:08 LuanVSO

did you try disabling windows defender real time protection to measure the performance?

Yes, see the column named "Anti-virus" in results.txt.

kjarvel avatar Aug 31 '20 06:08 kjarvel

Is this specific to gcc or also observable with MSVC ?

iamsergio avatar Nov 26 '20 22:11 iamsergio

Is this specific to gcc or also observable with MSVC ?

See build_cmd.bat and the results for build_cmd.bat in results.txt. It does not use gcc.

kjarvel avatar Nov 28 '20 23:11 kjarvel

You know, this is weird. I'd be fairly sure that checking the "use legacy console" checkbox would remove the issue, if it was something in the Console v2 codebase. That's pretty literally the exact code from the Windows 7 build, with only minor modifications to get it loaded into the v2 console.

We've been making pretty constant perf improvements over the years (case in point: https://github.com/microsoft/terminal/issues/1064#issuecomment-618024330). At this point, the Terminal is generally faster than the Console at all.

If you're still seeing this, would you mind trying to trace your build (or at least part of it) with WPA? I think we'd all be curious to see what the hot paths are.

zadjii-msft avatar Nov 22 '21 15:11 zadjii-msft

Thanks for the response. Yes, I'm also guessing that it does not have to do with the Console itself, but some underlying limitation. I once again tried the original bat file 'build_cmd.bat' that is attached in 'scripts.zip' - on a brand new computer.

You can easily try this yourself, it requires no external dependencies, and you will see the same results. Since you can also try this bat file within 3 minutes (1 minute on Win7) I ask you to trace it with WPA, because I don't know what that is, or how to use it.

My results now in 2021, performed on the same computer:

  • Windows 11: ~3 minutes to complete build_cmd.bat
  • Windows 7: ~1:30 to complete build_cmd.bat

Conclusion: Windows 7 runs the script twice as fast, even when running in a Virtual machine, on the same computer.

See attached video. Windows 7 to the left. Windows 11 to the right: win7_vs_win11_2021.zip

kjarvel avatar Nov 22 '21 23:11 kjarvel