protected int getIndexForClassNode(Node<OWLClass> n) {
Preconditions.checkNotNull(n);
if (!classNodeToIntegerMap.containsKey(n))
LOG.error("No such node: " + n);
return classNodeToIntegerMap.get(n);
}
is called by
private Set<Integer> getIntegersForClassSet(NodeSet<OWLClass> nodeset) {
Set<Integer> bits = new HashSet<>();
for (Node<OWLClass> n : nodeset.getNodes()) {
if (n.contains(getOWLNothing()))
continue;
bits.add(getIndexForClassNode(n));
}
return bits;
}
So this just ends up converting an Integer to an int back to an Integer many times for each OWLClass and OWLNamedIndividual in each ontology. This is likely using a lot more CPU than required.
getIndexForClassNode is also marked as protected instead of private, but appears to be capable of being private as its only used internally in the class itself being called from private methods. Should this really be the case then it should be safe to return an Integer without breaking anything.
is called by
So this just ends up converting an
Integer
to anint
back to anInteger
many times for eachOWLClass
andOWLNamedIndividual
in each ontology. This is likely using a lot more CPU than required.getIndexForClassNode
is also marked as protected instead of private, but appears to be capable of being private as its only used internally in the class itself being called from private methods. Should this really be the case then it should be safe to return anInteger
without breaking anything.@cmungall is this really a safe change to make?