Esp32 windows toolchain is 5x slow compared to Linux

vinodstanur
Posts: 27
Joined: Thu Jun 08, 2017 12:59 pm

Esp32 windows toolchain is 5x slow compared to Linux

Postby vinodstanur » Fri Jul 19, 2019 7:27 pm

Hi,
I am using esp-idf 3.2.2 and compiler 5.xyz on windows. The entire build from a clean state is taking around 2 minutes on my i7 8th gen cpu which is having 8 logical cores. It is hitting 4.5GHz and I am using make -j8 and I can see cpu hitting 100% in task manager. No other task is running. It took around 2 minutes 15 seconds to build one of my application.

Same application I am able to build on virtualbox Xubuntu in same system in less than 20 seconds with make -j8. I am wondering why this is happening like this.

What I feel is the tool chain build for windows along with the mingw32 setup is not optimised for windows. Virtual box linux is building it 5x faster than the windows based tool chain.

Any ways to improve the speed in windows ? (Windows 10)

jcsbanks
Posts: 305
Joined: Tue Mar 28, 2017 8:03 pm

Re: Esp32 windows toolchain is 5x slow compared to Linux

Postby jcsbanks » Fri Jul 19, 2019 8:55 pm

Disable Windows defender scanning of the project folder.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Esp32 windows toolchain is 5x slow compared to Linux

Postby WiFive » Fri Jul 19, 2019 9:16 pm


vinodstanur
Posts: 27
Joined: Thu Jun 08, 2017 12:59 pm

Re: Esp32 windows toolchain is 5x slow compared to Linux

Postby vinodstanur » Sat Jul 20, 2019 12:47 pm

jcsbanks wrote:
Fri Jul 19, 2019 8:55 pm
Disable Windows defender scanning of the project folder.
Thanks, I tried this method and the speed increased.

I did not compared with linux virtualbox yet, but I remember my project code was building with in 30 seconds or less than that.

I tried on Windows Linux Subsystem and the speed is same,
the getting started hello world code took 1 minute 3 seconds to build completely on both WLS UBUNTU on Windows 10 and directly on windows 10 using msys32, so practically no speed difference in WLS Linux and Windows 10 msys32.

Windows Subsystem for linux - Ubuntu inside

Code: Select all

vinod@LAPTOP-H09BLBKV:/mnt/d/Projects/esp32/hello_world$ xtensa-esp32-elf-cc -v
Using built-in specs.
COLLECT_GCC=xtensa-esp32-elf-cc
COLLECT_LTO_WRAPPER=/home/vinod/xtensa-esp32-elf/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/lto-wrapper
Target: xtensa-esp32-elf
Configured with: /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf --prefix=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-sysroot=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-80-g6c4433a' --disable-__cxa_atexit --enable-cxx-flags='-fno-rtti -ffunction-sections' --with-gmp=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpfr=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpc=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-isl=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-cloog=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-libelf=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-libgomp --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-nls --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio
Thread model: posix
gcc version 5.2.0 (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a)
Windows 10 msys32

Code: Select all

VINOD S@LAPTOP-H09BLBKV MINGW32 /d/Projects/esp32win/hello_world
$ xtensa-esp32-elf-cc.exe -v
Using built-in specs.
COLLECT_GCC=C:\msys32\opt\xtensa-esp32-elf\bin\xtensa-esp32-elf-cc.exe
COLLECT_LTO_WRAPPER=c:/msys32/opt/xtensa-esp32-elf/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/lto-wrapper.exe
Target: xtensa-esp32-elf
Configured with: /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/configure --build=x86_64-build_pc-linux-gnu --host=i686-host_pc-mingw32 --target=xtensa-esp32-elf --prefix=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-sysroot=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-80-g6c4433a5' --disable-__cxa_atexit --enable-cxx-flags='-fno-rtti -ffunction-sections' --with-gmp=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools/complibs-host --with-mpfr=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools/complibs-host --with-mpc=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools/complibs-host --with-isl=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools/complibs-host --with-cloog=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools/complibs-host --with-libelf=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools/complibs-host --enable-lto --enable-target-optspace --without-long-double-128 --disable-libgomp --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-nls --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio
Thread model: posix
gcc version 5.2.0 (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a5)

Now the interesting part is, my project is now taking 2 minutes in WSL Ubuntu and taking only 1minutes 30 seconds in msys32!
It means WSL Linux is slower than the Virtualbox Linux and msys32 based windows toolchain after windows defender is turned off for the particular project folder!

I will update about the virtualbox based build performance soon.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Esp32 windows toolchain is 5x slow compared to Linux

Postby Ritesh » Sat Jul 20, 2019 2:22 pm

jcsbanks wrote:
Fri Jul 19, 2019 8:55 pm
Disable Windows defender scanning of the project folder.
Hi,

How to disable it as we are also facing issue into windows system as well some times?

We have checked with -d option into make and it seems like it is going to traverse all mk files which seems to take much time for windows.
Regards,
Ritesh Prajapati

vinodstanur
Posts: 27
Joined: Thu Jun 08, 2017 12:59 pm

Re: Esp32 windows toolchain is 5x slow compared to Linux

Postby vinodstanur » Sat Jul 20, 2019 10:05 pm

To disable windows defender for specific folder, go to windows defender settings, add exception option for folder in which the project it.


This increases the speed. This option is available when no antivirus is installed. If you have already some antivirus, then you can disable it while building tue code, then the speed will be increased.

Apart from that try using make -j4 on 4 logical core cpu and -j8 on latest i7 with 8 logical cores.


But what ever we do, we cannot achieve virtualbox Linux or true boot Linux toolchain speed. What I understood is that the compiler is more friendly to Linux operating system due to various technical reason and the ported cross compiler in windows system is not that optimised for windows os and it takes more time to build. More than double speed is achieved in Virtualbox Linux compared to the windows defender disabled msys32 based toolchain.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Esp32 windows toolchain is 5x slow compared to Linux

Postby Ritesh » Sat Jul 20, 2019 11:56 pm

vinodstanur wrote:
Sat Jul 20, 2019 10:05 pm
To disable windows defender for specific folder, go to windows defender settings, add exception option for folder in which the project it.


This increases the speed. This option is available when no antivirus is installed. If you have already some antivirus, then you can disable it while building tue code, then the speed will be increased.

Apart from that try using make -j4 on 4 logical core cpu and -j8 on latest i7 with 8 logical cores.


But what ever we do, we cannot achieve virtualbox Linux or true boot Linux toolchain speed. What I understood is that the compiler is more friendly to Linux operating system due to various technical reason and the ported cross compiler in windows system is not that optimised for windows os and it takes more time to build. More than double speed is achieved in Virtualbox Linux compared to the windows defender disabled msys32 based toolchain.
Thanks.

We will check it out side with settings into windows 10 system and let you know if need anything else for same.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: ESP_Sprite and 66 guests