This is a static copy of a profile report

Home

ArgumentParser>ArgumentParser.canonicalizeNames (Calls: 4, Time: 0.005 s)
Generated 04-Jun-2021 04:11:05 using performance time.
class method in file C:\Program Files\MATLAB\R2020b\toolbox\shared\io\general\+matlab\+io\+internal\+validators\ArgumentParser.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...e>AcceptsFileType.getFileTypeFirstclass method2
...;ExecutableFunction.validateArgumentsclass method2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
146
names(kk) = obj.checkAlias(nam...
20.001 s26.9%
144
for kk = nonZero
40.001 s18.7%
149
matches = matchPartial(allName...
20.001 s9.9%
163
results.CanonicalNames(kk) = a...
20.000 s8.0%
138
nonZero = find(strlength(names...
40.000 s6.2%
All other lines  0.002 s30.4%
Totals  0.005 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
ArgumentParser>ArgumentParser.checkAliasclass method20.001 s17.5%
ArgumentParser>matchPartialclass method20.000 s4.5%
Self time (built-ins, overhead, etc.)  0.004 s78.0%
Totals  0.005 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function38
Non-code lines (comments, blank lines)12
Code lines (lines that can run)26
Code lines that did run19
Code lines that did not run7
Coverage (did run/can run)73.08 %
Function listing
time 
Calls 
 line
 129 
        function results = canonicalizeNames(obj, names)
 130 
        % Used to match names from partial matches, and replace aliases
 131 
        % with the corrected canonical names
< 0.001 
      4 
 132
        names = convertCharsToStrings(names); 
< 0.001 
      4 
 133
        results.CanonicalNames = names; 
< 0.001 
      4 
 134
        allNames = obj.ParameterNames; 
< 0.001 
      4 
 135
        hasAliases = ~isempty(obj.Aliases); 
 136 
        
 137 
        % indices of the non-empty, non-missing elements
< 0.001 
      4 
 138
        nonZero = find(strlength(names) > 0); 
 139 
        
 140 
        % Initialize the struct fields
< 0.001 
      4 
 141
        results.NonMatched = strings(0);  
< 0.001 
      4 
 142
        results.AmbiguousMatch = struct('idx',{},'names',{}); 
 143 
        
  0.001 
      4 
 144
        for kk = nonZero 
< 0.001 
      2 
 145
            if hasAliases 
  0.001 
      2 
 146
                names(kk) = obj.checkAlias(names(kk)); 
< 0.001 
      2 
 147
            end 
 148 
            
< 0.001 
      2 
 149
            matches = matchPartial(allNames,names(kk)); 
 150 
            
 151 
            % If multiple matches were found, pick the exact match over a
 152 
            % different partial match
< 0.001 
      2 
 153
            if nnz(matches) > 1 
 154 
                exactMatch = strcmpi(allNames,names(kk));
 155 
                if nnz(exactMatch) == 1
 156 
                    results.CanonicalNames(kk) = allNames(exactMatch);
 157 
                else
 158 
                    results.AmbiguousMatch(end+1) = struct('idx',kk,'names',allNames(matches)); %#ok<*AGROW>
 159 
                end   
< 0.001 
      2 
 160
            elseif nnz(matches) ~= 1 
 161 
                results.NonMatched(end+1) = names(kk);
< 0.001 
      2 
 162
            else % one (at worst) partial match 
< 0.001 
      2 
 163
                results.CanonicalNames(kk) = allNames(matches); 
< 0.001 
      2 
 164
            end 
< 0.001 
      2 
 165
        end 
< 0.001 
      4 
 166
        end 

Other subfunctions in this file are not included in this listing.