Do two passes of query param encoding one after another. This should give somewhat more cache locality.