Example of translation after parsing clap for performance #9615
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.
I wanted to learn a bit about the performance characteristics of coreutils for the commands that were listed as being slower than the GNU implementations. One of the reasons listed for being slower is that the translation files are parsed even when they are not needed: #9103
I was able to find some examples online of how you can add a wrapper to the clap parser that can modify the clap command if it recognizes that the help command is being called and then the translation keys can be obtained. When doing the original comparisons using hyperfine commands shown in that issue, my timing was similar to what was described in the issue but afterwards it moved from 2. ms to 1.0 ms.
This tells me that after adding the fix for the translations to not be parsed, we have a clear path to replacing some of the glibc calls with more native functionality using nix and we should be able to perform faster than the GNU implementation.