optimize canonicalizeName() method calls