mbland / go-script-bash

Framework for writing modular, discoverable, testable Bash scripts
ISC License
96 stars 16 forks source link

Use optimized Bats from mbland/bats #165

Closed mbland closed 7 years ago

mbland commented 7 years ago

For even greater details, see the comment for the optimized-20170215 tag from https://github.com/mbland/bats.

With this commit, on a MacBook Pro with a 2.9GHz Intel Core i5 CPU and 8GB 1867MHz DDR3 RAM, using Bash 4.4.12(1)-release (the latest at the time of writing), the ./go test suite now runs in:

  real    1m20.347s
  user    0m55.040s
  sys     0m18.208s

The impact is even more dramatic on Windows. On the same MacBook Pro, running Windows 10 under VMware Fusion 8.5.3 with 4GB RAM, the timing for ./go test before the changes from #156 was in the O(50-60min) range for every version of Bash I have installed. Afterwards, it was down in the O(20+min range).

Using Bats with these changes included, running the MSYS2-based Bash 4.3.46(2)-release that ships with (what is probably a slightly outdated version of) Git for Windows, the suite now runs in:

  real    6m20.981s
  user    1m53.852s
  sys     3m16.015s

Running Bash 4.4.11(2)-release running under Cygwin:

  real    5m22.506s
  user    1m34.462s
  sys     2m41.568s

And running Bash 4.3.11(1)-release as part of the Windows Subsystem for Linux (i.e. Ubuntu on Windows 10):

  real    3m40.502s
  user    0m36.531s
  sys     3m1.516s

In addition to the Bash versions mentioned above, I've also tested these changes using the following Bash versions:

All of the go-script-bash tests passed on these other platforms in less than half the time from before.

I'll open a PR against https://github.com/sstephenson/bats shortly.

cc: @stroupaloop

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 95.264% when pulling 5e73172f95f34d1fadd0999873ec4a50f9f4021c on optimized-bats into 69ad67f8474522540c9f90d7fd4f93903aaa63ce on master.