Eliminate duplicates and improve performance #81744
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposal:
1. Add
.vscode
to the allow listCurrently, IntelliJ IDEA’s
.idea
directories and.iml
files are already excluded from conflict checks.Similarly, Visual Studio Code (VS Code) is widely used, and
.vscode
directories are commonly present in project folders.Adding
.vscode
to the allow list would improve the developer experience for VS Code users,especially when using tools like
create-next-app
within existing project folders.2. Use
Set
for performance and clarityThe current implementation uses an array (
Array
) and checks file inclusion withArray.prototype.includes()
.Replacing this with a
Set
and usingSet.prototype.has()
offers two key advantages:Set.has()
is generally faster thanArray.includes()
(O(1) vs O(n)). While the list is currently small, this is a good practice for scalability.Set
clearly represents a unique collection of values, aligning with the goal of checking for duplicates.These improvements help make the codebase more robust and user-friendly.