Repository navigation
Using Trie Class for Efficient Text Pattern Searching in C#: net11.0 and a benchmark that searches the text - #2428
Open
vladimir-pecanac-main wants to merge 1 commit into
Conversation
…d benchmark Retarget both projects to net11.0 and update BenchmarkDotNet to 0.15.8 and the xUnit packages. Trie gains ContainsPattern(), GetWordsWithPrefix() and a CollectWords() helper. The benchmark runs InProcess, adds the pattern in GlobalSetup, returns the find count from every method, calls ContainsPattern() instead of the whole-word Search() and adds a string.Contains() baseline. Six new tests, including one that checks every benchmark method finds the pattern on every iteration.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Moves the Trie sample to net11.0 with BenchmarkDotNet 0.15.8 and xUnit 2.9.3. The Trie class gets ContainsPattern(), which really searches a text for the stored patterns, and GetWordsWithPrefix() for prefix lookups. The benchmark used to time the whole-word Search() on the full text, which failed after one lookup; it now calls ContainsPattern(), runs InProcess with the pattern added in GlobalSetup, returns the find count from every method and adds a string.Contains() baseline. Six new tests bring the total to 22, including one that checks every benchmark method finds the pattern on every iteration.