Hacker News new | ask | show | jobs
by ordinary 3520 days ago
I have not tried Bash for Windows, but I've been a Cygwin user for almost a decade.

The main problem I have with using any kind of shell on Windows is that process spawning takes much, much longer than on *nix systems. I regularly find myself optimizing my scripts not for readability or elegance, but for total number of calls to executables.

To illustrate, opening a new Cygwin Bash shell on this machine takes 3 seconds, almost all of which is spent executing .bashrc. On Linux, with the same .bashrc (modulo a few platform-specific settings) that's under 0.2 seconds.

So, far from perfect, but is it 'good enough'? I'd say yes. Bash is just so much nicer than CMD, and while I hear good things about PowerShell, I can't be bothered to learn a different shell for every platform I use.

Whether there are additional tradeoffs with Bash for Windows, I cannot judge.

3 comments

One cannot infer the behaviour of the Windows Subsystem for Linux from the behaviour of Cygwin. The two are quite different things.

You're also being misled by the misleading "Bash on Windows" marketing name. It's not bash, even primarily. It's a "personality" subsystem for running Linux binaries on top of the Windows NT kernel. And that's what jiantastic is asking about: whether the subsystem, with what Linux programs it can run and what limitations it has, is "good enough" as a development environment, which includes considering everything from running compilers to hosting test rigs. Xe is not asking whether the Bourne Again shell is better than some other command interpreter.

It's actually not bashrc that is the direct culprit but a few issues with how Cygwin emulates posix.

Best solution is to edit /etc/bash_completion.d and remove anything you don't need this can shave off 2-3 seconds of the load time.

Since windows now should have a native fork() call Cygwin might be updated on its own which will make it about as fast as a native nix system, that said Cygwin will need to make a dedicated version for windows 10 for this to work.

I remember I cut down a lot of the cyg shell startup time by removing a lot of the completion files I wasn't actively using from .bashrc.

But yes, it is generally slower. I'm much happier to be back to Linux these days.