ENC with smart class parameters is slow (regression with 1.16)
If a host uses a lot of smart class parameters (50+), running the ENC gets awful slow. Runtimes of 10 or more seconds have been reported. The runtime grows linear with the number of parameters.
Classification::ValuesHashQuery#values_hash is used to retrieve all the parameters used in the ENC. For each key this method calls lookup_values_cache with the same parameters. The called method assembles a database query, which is pretty slow, even if it never shows up in the ActiveRecord time and just runs against the cache.
The simple fix just calculates the result of lookup_values_cache once.
However I'm not sure if this code is even correct now, as different parameters can have different orders.