By hardcoding
os=Msys
gcc=arm-none-eabi-gcc
exefile=arm-none-eabi-gcc
inside incdir.sh
time tools/incdir.sh -s arm-none-eabi-gcc/home/Schock/nuttx/nuttx/include
reduced from 180ms to 40ms.

Overall, this reduced build time from 30min to an acceptable 6min.
So incdir.sh is taking too much time in MSYS2

Isn't there a possibility to cache the results of the system checks inside incdir.sh?

The cost of getting 'os' is fork + new shell + uname
The cost of gcc is fork + new shell + grep
The cost of exfile if for + new shell + basename

Yes, so that does have to fork a lot of additional shell instances.  Perhaps you could use environment variables to cache results.  I think that Bash can access environment variables without forking.

For example,  I think that you replace the line:

    os=`uname -o 2>/dev/null || echo "Other"`

with

    |if[-z ${os+x}];then|
    export os=`uname -o 2>/dev/null || echo "Other"`
    fi

See discussion of syntax at https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash

We could probably greatly improve build performance if this were done throughout the OS.  An alternative might be to set a large set of environment variables as part of the 'make context' phase.

In either case, we would also have to unset the environment variables on distclean as well.


Reply via email to