diff scripts/testfun/rundemos.m @ 17459:f271fa40074d

runtests.m, rundemos.m: Use readdir, rather than dir, for ~700X speed-up. * scripts/testfun/rundemos.m, scripts/testfun/runtests.m: Use readdir, rather than dir, for ~700X speed-up.
author Rik <rik@octave.org>
date Sun, 22 Sep 2013 08:15:59 -0700
parents a4f86f459744
children 9411ad1afa84
line wrap: on
line diff
--- a/scripts/testfun/rundemos.m	Sun Sep 22 08:00:00 2013 -0700
+++ b/scripts/testfun/rundemos.m	Sun Sep 22 08:15:59 2013 -0700
@@ -64,10 +64,10 @@
 endfunction
 
 function run_all_demos (directory, do_class_dirs)
-  flist = dir (directory);
+  flist = readdir (directory);
   dirs = {};
   for i = 1:numel (flist)
-    f = flist(i).name;
+    f = flist{i};
     if ((length (f) > 2 && strcmpi (f((end-1):end), ".m")) ||
         (length (f) > 3 && strcmpi (f((end-2):end), ".cc")))
       f = fullfile (directory, f);
@@ -81,9 +81,11 @@
           input ("Press <enter> to continue: ", "s");
         endif
       endif
-    elseif (flist(i).isdir && f(1) == "@")
+    elseif (f(1) == "@")
       f = fullfile (directory, f);
-      dirs = {dirs{:}, f};
+      if (isdir (f))
+        dirs(end+1) = f;
+      endif
     endif
   endfor