Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a new `Tap.tap_registry` method that will load all installed and core taps only once instead of doing it every time on the fly. We only expect this list to change when a tap is installed or uninstalled in the lifetime of the program. The only places where that can happen are in the `Tap#install` and `Tap#uninstall` methods so we make sure to update the tap registry when those methods are called. This increase the performance of `Tap#reverse_tap_migrations_renames` since most of that time was spent in `Tap.each` loading the installed taps from the tap directory. On my local computer, the performance goes from 3+ seconds to around 0.2 when calling `Tap.each(&:to_s)` in a loop 6k times. 6k is around the number of formulae in the core tap so this is not unheard of. Other changes: - Override `Tap#eql?` and `Tap.hash` so we can store them uniquely in sets - Update tests to check that taps are getting added and removed from the registry when they get installed and uninstalled
- Loading branch information