Sharded Performance improvement

'SortedMap.isEmpty()' performance is much higher than
'SortedMap.size()==0'
This commit is contained in:
panos
2012-08-13 10:35:51 +08:00
parent 6c3ec9fc14
commit 63b40b71f7

View File

@@ -77,7 +77,7 @@ public class Sharded<R, S extends ShardInfo<R>> {
public S getShardInfo(byte[] key) {
SortedMap<Long, S> tail = nodes.tailMap(algo.hash(key));
if (tail.size() == 0) {
if (tail.isEmpty()) {
return nodes.get(nodes.firstKey());
}
return tail.get(tail.firstKey());