This is a static copy of a profile report

Home

HasPropertiesAsNVPairs>getParserByClass (Calls: 47, Time: 0.004 s)
Generated 04-Jun-2021 04:11:10 using performance time.
class method in file C:\Program Files\MATLAB\R2020b\toolbox\shared\io\general\+matlab\+io\+internal\+mixin\HasPropertiesAsNVPairs.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...gt;HasPropertiesAsNVPairs.parseInputsclass method47
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
70
if map.isKey(classname)
470.002 s53.2%
71
p = map(classname);
470.001 s20.2%
61
if isempty(map)
470.001 s14.5%
59
persistent map baseParser
470.000 s5.8%
101
end
470.000 s0.6%
All other lines  0.000 s5.7%
Totals  0.004 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function44
Non-code lines (comments, blank lines)11
Code lines (lines that can run)33
Code lines that did run7
Code lines that did not run26
Coverage (did run/can run)21.21 %
Function listing
time 
Calls 
 line
  58 
function p = getParserByClass(classname)
< 0.001 
     47 
  59
persistent map baseParser 
  60 

< 0.001 
     47 
  61
if isempty(map) 
  62 
    map = containers.Map('KeyType','char','ValueType','any');
  63 
    baseParser = inputParser;
  64 
    baseParser.PartialMatching = false;
  65 
    baseParser.CaseSensitive = false;
  66 
    baseParser.KeepUnmatched = true;
  67 
    baseParser.StructExpand = true;
< 0.001 
     47 
  68
end 
  69 

  0.002 
     47 
  70
if map.isKey(classname) 
< 0.001 
     47 
  71
    p = map(classname); 
  72 
else
  73 
    % create custom parser for this class
  74 
    newParser = baseParser.copy();
  75 
    newParser.FunctionName = classname;
  76 
    % get public properties
  77 
    props = unique(properties(classname))';
  78 
    
  79 
    % Add accessable properties given access by this mixin class
  80 
    % This treats properties as NV pairs that might otherwise not be settable
  81 
    % through the public interface.
  82 
    me = meta.class.fromName(classname);
  83 
    access = {me.PropertyList(:).GetAccess};
  84 
    for i = 1:numel(access)
  85 
        accessList = [access{i}];
  86 
        if iscell(accessList) 
  87 
            accessors = [accessList{:}];
  88 
            if any(strcmp('matlab.io.internal.mixin.HasPropertiesAsNVPairs',{accessors.Name}))
  89 
                props{end+1} = me.PropertyList(i).Name; %#ok<AGROW>
  90 
            end
  91 
        end
  92 
    end
  93 
    
  94 
    for p = props
  95 
        newParser.addParameter(p{:},[]);
  96 
    end
  97 
    map(classname) = newParser;
  98 
    p = newParser;
< 0.001 
     47 
  99
end 
 100 

< 0.001 
     47 
 101
end 

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