When hanging facet.query under pivots, the query (and localparams) is parsed for every pivot value. We can avoid it by parsing and caching the query object just once during FacetComponent#prepare.
As noted by Hoss in
It's not just an issue of localparams, but also the parsing & construction of the Query object – doing that once per request (just like the way you've changed the range faceting to do all the bucket calculation once) could give us some serious performance savings when facet.query params are hung of of many and/or large pivot trees. (should just mean a pretty trivial new subclass of FacetBase that also has a public Query getQuery() accessor)