You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* delay error list allocation until it's needed
* add nullable annotation for Parser.Parse(arguments), avoid allocation when it's actually null
* don't allocate a new list to normalize RootCommand
* don't call EndsWith just to check one character
* avoid allocations for parsing directives:
* don't allocate new string to remove brackets
* don't allocate an array of characters (string.Split argument)
* don't allocate an array of strings (result of string.Split)
* delay List<SyntaxNode> allocation
* token type checks can be performed only for debug builds (these are internal methods that we control)
* remove unused property that was allocating a list
* delay List<OptionResult> allocation
* delay List<ArgumentResult allocation
* delay Dictionary<string, IReadOnlyList<string>> allocation
* store the results of ParseResult.UnmatchedTokens and re-use it since it's creating a copy every time it's called!
* avoid allocations when there are no unmatched tokens
* Since TokenizeResult.Tokens is not public and not used anywhere after the parsing,
we take advantage of its mutability and remove the root command token
instead of creating a copy of the whole list.
* remove TokenizeResult to reduce JIT time and allocations
* delay List<ParseError> allocation
* don't access Command.Options if there are no options defined (it allocates a list)
* don't access Command.Arguments if there are no arguments defined (it allocates a list)
* don't access Command.Subcommands if there are no commands defined (it allocates a list)
* delay List<SymbolResult> allocation
* delay List<Token> allocation
* not every SymbolResult needs to contain a Dictionary<Argument, ArgumentResult>
duplicate the code rather than introducing new public type like IdentifierSymbolResult
* Aliases are internally backed by a HashSet, there is no point in creating a Union of the same hash set
* avoid list allocation
* address code review feedback
/// Gets the directives found while parsing command line input.
100
99
/// </summary>
101
100
/// <remarks>If <see cref="CommandLineConfiguration.EnableDirectives"/> is set to <see langword="false"/>, then this collection will be empty.</remarks>
0 commit comments