Skip to content

Refactor InternalPrefixedConfig to use StringBuilder for namespace construction - #1619

Open
omer-cengel wants to merge 1 commit into
Netflix:masterfrom
omer-cengel:refactor/internal-prefixed-config-string-concat
Open

Refactor InternalPrefixedConfig to use StringBuilder for namespace construction#1619
omer-cengel wants to merge 1 commit into
Netflix:masterfrom
omer-cengel:refactor/internal-prefixed-config-string-concat

Conversation

@omer-cengel

Copy link
Copy Markdown

Summary

Refactored InternalPrefixedConfig to avoid String concatenation inside a loop by using StringBuilder.

Problem

The constructor of InternalPrefixedConfig was building the namespace prefix using String concatenation (+=) inside a loop, which is less efficient due to repeated String object creation.

Changes Made

  • Replaced String concatenation with StringBuilder in the constructor.
  • Preserved existing behavior for null, empty, and dotted namespace values.
  • Added unit tests to cover edge cases and ensure identical behavior.

Result

The code is more efficient, and clearer, with no behavioral changes.

Fixes

Fixes #1606

@marconi-prog marconi-prog left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Clean refactor, behavior preserved, and tests added.

@kimthienlang kimthienlang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor namespace prefix construction to avoid String concatenation in loop

3 participants