changeset 27916:4a30a58a44ab

lighting.m: Eliminate for loop introduced in 703156b6d602 for performance (bug #57537). * lighting.m: Directly add children of hggroups to variable "kids" rather than using a separate for loop over parents.
author Rik <rik@octave.org>
date Mon, 06 Jan 2020 12:56:15 -0800
parents 695bb9322a21
children 248b7b8f5a65
files scripts/plot/appearance/lighting.m
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/lighting.m	Mon Jan 06 10:38:00 2020 -0800
+++ b/scripts/plot/appearance/lighting.m	Mon Jan 06 12:56:15 2020 -0800
@@ -76,16 +76,15 @@
     hlist = [hlist; kids(strcmp(types, "surface"))];
     parents = kids(strcmp (types, "axes"));
     hglist = kids(strcmp (types, "hggroup"));
+
+    kids = get (parents, "children");
     for i = 1 : numel (hglist)
       props = get (hglist(i));
       if (! isfield (props, "levelstep"))
-        parents(end+1) = hglist(i);
+        kids = [kids; get(hglist(i), "children")];
       endif
     endfor
-    kids = [];
-    for i = 1 : numel (parents)
-      kids = [kids; get(parents(i), "children")];
-    endfor
+
   endwhile
 
   ## FIXME: This is the old, simple code.