> lookups to work with an arbitrary query, you would either need to changed > the cache structure from Query=>DocSet to a mapping of > Query=>[DocSet,inverseionBit] and store the same cache value needs needs > with two keys -- both the positive and the negative; or you keep the
Well, I don't know how it's working right now, but I guess that, as the positive version is being stored, when you look a negative query up, you already have a similar lookup problem: or you store two keys for the same value or you just transform the negative query into a positive "canonical" one before looking it up. The same could be done in this case, with the difference that yes, you need an inversion bit stored too. The double lookup option sounds worse, though benchmarking should be done to know for sure. Would this optimization influence only memory usage or also smaller sets are faster to intersect, for example? Well, in any case, saving memory allows to use the additional memory to speed up the application, for example, with bigger caches.