You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit changes the iteration order when checking for element
equality. This is based on the educated guess that child elements
will likely differ while parents will probably be the same.
E.g. comparing "spring.banner.charset" with "spring.banner.location"
will now first check "charset" against "location" and thus saves some
cycles for elements that will be the same.
See gh-15782
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -237,7 +237,7 @@ public boolean isAncestorOf(ConfigurationPropertyName name) {
237
237
if (this.getNumberOfElements() >= name.getNumberOfElements()) {
238
238
returnfalse;
239
239
}
240
-
for (inti = 0; i < this.elements.getSize(); i++) {
240
+
for (inti = this.elements.getSize() - 1; i >= 0; i--) {
241
241
if (!elementEquals(this.elements, name.elements, i)) {
242
242
returnfalse;
243
243
}
@@ -309,7 +309,7 @@ public boolean equals(Object obj) {
0 commit comments