Description
Each time we access an index using a value, we do a normalization of this value. This is potentially an costly operation, which is mostly a duplicated work. In order to spare such an operation, a cache is added to the index, but it has two drawbacks :
- first the cache is small (default size is 100, just enough to store 50 values at most, as we register both the normal value and the normalized value)
- second, this cache is synchronized to avoid inconsistencies, so it induce some contention
We should assume that the value is always normalized when we use such an index, and remove this extra normalization, and the associated cache.
Note that we may use a Attribute value, or a Long (for the reverse index), so it would be quite a good idea to create two different type of indexes :
- AttributeType index
- ID indexes
instead of using generic indexes all the time.
Last, in order to be sure that we use normalized values, it's enough to add a flag in the Value<?> class to tell if the value is normalized or not. If it's not, we just have to normalize it.