Hi,

I created a custom FSIndex for an annotation type in the hope of speeding up 
lookup based on one of it’s fields, but after some profiling I found to my 
surprise that this doesn’t appear to be what I get. I specified the index to be 
sorted according to two fields where the first is a key and the next is a value 
field. After creating a filtered iterator with the key field as one of the 
constraints I thought it would do a quick lookup to the first element in the 
list that matches the key constraint, after all it’s sorted according to that 
field, so I assume at least binary search is possible, but to my surprise that 
is not what happens. It seems to simply iterate through all elements and skips 
those that don’t match the constraint. There doesn’t seem to be other ways I 
can do a more efficient jump to the first element in the index and then stop 
iterating when the key no longer matches.

I am somewhat baffled by this, and it appears to me I could have achieved the 
same using a normal select with some simple filtering, which kinda makes the 
FSIndex redundant. There is another way to obtain an iterator, which takes a 
FeatureStructure, but I am not sure if that is more efficient, and does this 
mean that you create FeatureStructures for the sole purpose of lookup into the 
index? I would appreciate if someone could explain this to me, thanks! :)

Cheers,
Mario













Reply via email to