Significant speedup in StructureMatcher._anonymous_match