On Cygwin, FWIW, it pays huge dividends to avoid making the shell fork at all costs. Don't use $(sed ...). Use ${variable%foo%bar} or whatever. Cygwin punishes you hard for unnecessary fork().
As it turns out, avoiding unnecessary fork() is good hygiene everywhere.