This is a static copy of a profile report

Home

makeValidName>getMakeValidFcnHandle/makeValid (Calls: 1, Time: 0.002 s)
Generated 18-May-2021 16:05:21 using performance time.
nested function in file /usr/local/MATLAB/R2021a/toolbox/matlab/lang/+matlab/+lang/makeValidName.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...n)makeValid(n,@replaceWithUnderscore)anonymous function1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
162
if iskeyword(name(keywordIdx))
630.001 s57.4%
158
name = invalidReplacementFun(n...
10.000 s14.8%
169
name = regexprep(name,'^(?![a-...
10.000 s6.0%
161
for keywordIdx = 1:numel(name)
10.000 s5.9%
172
isTooLong = (strlength(name) &...
10.000 s5.3%
All other lines  0.000 s10.7%
Totals  0.002 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
iskeywordfunction630.001 s31.0%
...eValidFcnHandle/replaceWithUnderscorenested function10.000 s11.5%
Self time (built-ins, overhead, etc.)  0.001 s57.5%
Totals  0.002 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function31
Non-code lines (comments, blank lines)11
Code lines (lines that can run)20
Code lines that did run13
Code lines that did not run7
Coverage (did run/can run)65.00 %
Function listing
time 
Calls 
 line
 148 
    function name = makeValid(name, invalidReplacementFun)
 149 
        % Remove leading and trailing whitespace and
 150 
        % replace embedded whitespace with camel/mixed casing.
< 0.001 
      1 
 151
        whitespace = compose([" ", "\f", "\n", "\r", "\t", "\v"]); 
< 0.001 
      1 
 152
        if any(contains(name, whitespace)) 
 153 
            name = regexprep(name, '(?<=\S)\s+([a-z])', '${upper($1)}');
 154 
            name = erase(name, whitespace);
< 0.001 
      1 
 155
        end 
 156 
        
 157 
        % Replace invalid characters as specified by ReplacementStyle.
< 0.001 
      1 
 158
        name = invalidReplacementFun(name); 
 159 
        
 160 
        % Prepend keyword with PREFIX and camel case.
< 0.001 
      1 
 161
        for keywordIdx = 1:numel(name) 
  0.001 
     63 
 162
            if iskeyword(name(keywordIdx)) 
 163 
                name{keywordIdx} = [prefix, upper(name{keywordIdx}(1)), ...
 164 
                                            lower(name{keywordIdx}(2:end))];
< 0.001 
     63 
 165
            end 
< 0.001 
     63 
 166
        end 
 167 
        
 168 
        % Insert PREFIX if the first column is non-letter.
< 0.001 
      1 
 169
        name = regexprep(name,'^(?![a-z])', prefix, 'emptymatch', 'ignorecase'); 
 170 
        
 171 
        % Truncate NAME to NAMLENGTHMAX.
< 0.001 
      1 
 172
        isTooLong = (strlength(name) > namelengthmax); 
< 0.001 
      1 
 173
        if any(isTooLong) 
 174 
            for isTooLongIdx = reshape(find(isTooLong), 1, [])
 175 
                name{isTooLongIdx} = name{isTooLongIdx}(1:namelengthmax);
 176 
            end
< 0.001 
      1 
 177
        end 
< 0.001 
      1 
 178
    end 

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