add some comments about string interning

This commit is contained in:
Xavier Léauté 2014-08-26 17:15:24 -07:00
parent 73623467e7
commit d15cd8fde7
2 changed files with 9 additions and 1 deletions

View File

@ -673,6 +673,10 @@ public class IncrementalIndex implements Iterable<Row>
falseIdsReverse = biMap.inverse();
}
/**
* Returns the interned String value to allow fast comparisons using `==` instead of `.equals()`
* @see io.druid.segment.incremental.IncrementalIndexStorageAdapter.EntryHolderValueMatcherFactory#makeValueMatcher(String, String)
*/
public String get(String value)
{
return value == null ? null : poorMansInterning.get(value);

View File

@ -525,6 +525,10 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
}
for (String dimVal : dims[dimIndex]) {
/**
* using == here instead of .equals() to speed up lookups made possible by
* {@link io.druid.segment.incremental.IncrementalIndex.DimDim#poorMansInterning}
*/
if (id == dimVal) {
return true;
}
@ -597,4 +601,4 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
};
}
}
}
}