Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strip_prefix Method Based on Longest Match to ZeroTrie #4379

Closed
younies opened this issue Nov 29, 2023 · 0 comments · Fixed by #4383
Closed

Add strip_prefix Method Based on Longest Match to ZeroTrie #4379

younies opened this issue Nov 29, 2023 · 0 comments · Fixed by #4383
Assignees
Labels
A-performance Area: Performance (CPU, Memory)

Comments

@younies
Copy link
Member

younies commented Nov 29, 2023

In the experimental/unitsconversion/src/measureunit.rs file, we have a get_unit_id function that searches for an item in a ZeroTrie in an inefficient way. The current implementation iterates over each character in the string, creating a new identifier at each step and checking if it exists in the trie. This approach is not optimal.

To improve this, we propose adding a strip_prefix method to the ZeroTrie struct. This method should return the longest matching prefix in the trie and the remaining part of the string (returning the remaining part is optional).

The implementation of strip_prefix should be by searching in the try without needing to create new id/part for each iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-performance Area: Performance (CPU, Memory)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants