-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Use Cow for value in MergedCSTNode (#64)
In most scenarios, we don't need to create a new `String` when merging the values of two CSTNodes. More often than not, we simply pick the value from either the left or right node, or, ideally, the values of both nodes are equal to the base. Consequently, creating owned Strings is uncommon, and it would be more efficient to return a reference to the value of one of the `CSTNodes`. To accommodate this use case, this PR updates the `MergedCSTNode` to use `Cow<str>` instead of `String`. This change eliminates unnecessary `to_string` calls, potentially leading to performance improvements in some scenarios.
- Loading branch information
Showing
5 changed files
with
121 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.