Refactor: store hook repository in a local rather than re-fetch in loop.
Add totals to allocation output.
Fewer string allocations.
Remove an unneeded `compact` call.

This also reduces array allocations, since `compact` would create an
extra 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.
Use fewer string allocations in console_code_for.
Fewer array allocations.
Merge pull request #1812 from rspec/optimize-selection-of-applicable-filterable-items

A bunch of perf optimizations
whitespace cleanup
Remove unneeded layer of indirection.
Fix doc string.
Apply module inclusion to individual examples when filtered.

Previously it only applied to filtered groups. Luckily,
ruby’s object model supports this very easily through
the use of singleton classes.
Ensure shared contexts applied to one example have their hooks run.
Got things to work on 1.8.7.
Run `:context` hooks from shared contexts that apply to one example.
Make :context hooks in config apply to individual matching examples.
Add benchmarks for treating an example’s group instance’s singleton class as a group.