Skip to content

Speed up determination of which postgres bin

Ash McKenzie requested to merge ashmckenzie/speed-up-config-usage into master

What does this Merge Request do?

This MR speeds up the execution time of support/pg_bindir. It may not seem like much, but as support/pg_bindir is called within GDK::Config, it can get called quite a few times (depending on the scenario) and severely impacts both gdk doctor and the upcoming !1443 (merged).

Before

$ time support/pg_bindir
/Users/ash/.asdf/installs/postgres/11.8/bin
support/pg_bindir  1.90s user 1.38s system 80% cpu 4.057 total

$ time gdk doctor
-- snip --
gdk doctor  71.58s user 45.64s system 121% cpu 1:36.34 total

After

$ time support/pg_bindir
/Users/ash/.asdf/installs/postgres/11.8/bin
support/pg_bindir  0.27s user 0.31s system 59% cpu 0.972 total

$ time gdk doctor
-- snip --
gdk doctor  34.76s user 22.81s system 175% cpu 32.854 total

Merge Request checklist

  • Tests added for new functionality. If not, please raise Issue to follow-up.
  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Documentation added/updated, if needed.
  • gdk doctor test added, if needed.
Edited by Ash McKenzie

Merge request reports