-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLI] Add cache for reflection lookup of CLI arguments
Add cache for reflection lookup of CLI arguments. Replace CLI argument list with map. The current cli parser tries to match every possible command line argument against each command line argument, essentially in a double loop. This fix replaces one of the loops with a map lookup. Building the map is not expensive, and pays for itself even with a modest number of parameters. The map is cached between calls, making subsequent calls much cheaper. If run in a daemon, repeatedly parsing, e.g., 250 arguments, this speeds up argument parsing by a factor 20. Disallow -shortName=value in CLI arguments. Co-authored-by: Troels Lund <[email protected]> (cherry picked from commit b668433) #KTIJ-28245
- Loading branch information
1 parent
b0cc245
commit 316df8d
Showing
1 changed file
with
43 additions
and
39 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