Resolves SI-6196

Implements a version of filter and filterNot that reuses as much as
possible from the existing tree instead of building an entirely new one
like the builder-based filter does. This results in significant performance
improvements on average.

Adds a test of basic correctness of filter and filterNot as well as of the
desirable properties of the new filter implementation.

This is a collaboration between me and @Ichoran

Review by @Ichoran, @soc