Bash is really slow on Windows. See for yourself:

# builtin command
time { :; }
# Linux:   0.000s
# Windows: 0.000s

# builtin command in a subshell
time { ( : ); }
# Linux:   0.001s
# Windows: 0.054s

# non-builtin command
time { date; }
# Linux:   0.002s
# Windows: 0.108s

Notice that running a non-builtin command can be two orders of magnitude more expensive on Windows than on Linux. Creating a subshell is also very slow. Running 10 commands could cost as much as a full second, if not more! This is why shell scripts such as configure scripts are incredibly slow on Windows.

The results here are from Cygwin, but those from Mingw are in the same ballpark. This is probably due to the fact that forking is inherently slow on Windows due to the lack of direct support from the OS, so there’s little that can be done to avoid the performance penalty.

Moral of the story? If you are writing shell scripts for Windows, try to avoid making calls to non-builtin commands and avoid making subshells when possible. Unfortunately, there’s not much you can do with only builtin commands. Furthermore, many operations, such as command substitution \$(…) and pipelines … | … will implicitly spawn subshells. :(

On the bright side, printf is a builtin command in Bash, so at least you don’t have to choose between printf and echo for performance reasons (the latter being a portability nightmare).