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
Previously, when ConfigurationPropertyName was building the String
returned from toString() it would use a StringBuilder with the
default initial capacity of 16. For properties with several
elements this was likely to be too small resulting in the builder's
buffer being resized.
This commit sizes the StringBuilder as a multiple of the number of
elements in the name, attempting to strike a balance between
allocating a StringBuilder with an initial capacity that's too
large and wastes memory and an initial capacity that's too small
and requires resizing.
See gh-15760
Previously, the ElementsParser would be created using its default
capacity of 6 even when parsing a String that is expected to
produce a single element.
This commit updates ConfigurationPropertyName to create an
ElementsParser with a capacity of 1 when parsing a String that should
contain only a single element.
See gh-15760
Previously, ElementsParser would expand its internal storage when the
size of the storage was <= the end index of the element being parsed,
irrespective of how many elements had been stored. This led to
expansion of the storage, even for a source that contains a single
element, if the end of the element was at an index greater than the
size of the storage.
This commit updates ElementsParser to resize its storage when the size
(the number of elements that have been stored) is equal to the size of
the storage.
See gh-15760