Fewer string allocations.
compact! does fewer object allocations than compact since it mutates the array.
Hash#keys.any? creates an extra array compared to Hash#any?
When selecting a hash subset, it’s better to iterate over the smaller key list.

We expect `applicable_keys` to be very small — for example,
in rspec-rails, it may just contain `:type`. `metadata`,
in contrast, typically has at least 9 items.
Use fewer string allocations when creating the example group constant.