Mercurial > hg > octave-lyh
changeset 17391:1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
* scripts/plot/struct2hdl.m: Use ismember or struct array indexing
to replace arrayfun instances.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 05 Sep 2013 19:57:50 -0700 |
parents | 50b2863d10a6 |
children | 8c5878260636 |
files | scripts/plot/struct2hdl.m |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/struct2hdl.m +++ b/scripts/plot/struct2hdl.m @@ -191,7 +191,7 @@ plty = s.properties.__plotyy_axes__; addproperty ("__plotyy_axes__", h, "any"); tmp = [p [s.handle; h]]; - tst = arrayfun (@(x) any (plty == x), tmp(1:2:end)); + tst = ismember (tmp(1:2:end), plty); if (sum (tst) == numel (plty)) for ii = 1:numel (plty) plty(ii) = tmp(find (tmp == plty(ii)) + 1); @@ -453,7 +453,8 @@ bargroup = s.properties.bargroup; oldh = s.handle; - temp = arrayfun (@(x) any(x == bargroup), [p(1:2:end) oldh]); + temp = ismember ([p(1:2:end) oldh], bargroup); + tst = sum (temp) == length (bargroup); if (isscalar (bargroup) || !tst) @@ -547,7 +548,11 @@ more off; if (strcmpi (s.properties.tag, "")) specs = s.children(s.special); - hdls = arrayfun (@(x) x.handle, specs); + if (isempty (specs)) + hdls = []; + else + hdls = [specs.handle]; + endif nh = length (hdls); msg = ""; if (! nh)