comparison scripts/miscellaneous/what.m @ 18309:1456702a8b24

what.m: 3X performance boost. Don't display @fname as class unless it is a directory. * what.m: Use readdir rather than dir for 3X performance boost. Check all @filenames with isdir to only include true class directories.
author Rik <rik@octave.org>
date Tue, 14 Jan 2014 14:50:21 -0800
parents 2217bc116aa9
children 666c4e0aca1e
comparison
equal deleted inserted replaced
18307:87381dbbe25e 18309:1456702a8b24
43 endif 43 endif
44 endif 44 endif
45 d = dtmp; 45 d = dtmp;
46 endif 46 endif
47 47
48 files = dir (d); 48 files = readdir (d);
49 w.path = d; 49 w.path = d;
50 w.m = cell (0, 1); 50 w.m = cell (0, 1);
51 w.mex = cell (0, 1); 51 w.mex = cell (0, 1);
52 w.oct = cell (0, 1); 52 w.oct = cell (0, 1);
53 w.mat = cell (0, 1); 53 w.mat = cell (0, 1);
54 w.mdl = cell (0, 1); 54 w.mdl = cell (0, 1);
55 w.p = cell (0, 1); 55 w.p = cell (0, 1);
56 w.classes = cell (0, 1); 56 w.classes = cell (0, 1);
57 57
58 for i = 1 : length (files) 58 for i = 1 : length (files)
59 n = files(i).name; 59 n = files{i};
60 ## Ignore . and .. 60 ## Ignore . and ..
61 if (strcmp (n, ".") || strcmp (n, "..")) 61 if (strcmp (n, ".") || strcmp (n, ".."))
62 continue; 62 continue;
63 else 63 else
64 ## Ignore mdl and p files 64 ## Ignore mdl and p files
69 w.oct{end+1} = n; 69 w.oct{end+1} = n;
70 elseif (strcmp (e, mexext ())) 70 elseif (strcmp (e, mexext ()))
71 w.mex{end+1} = n; 71 w.mex{end+1} = n;
72 elseif (strcmp (e, ".mat")) 72 elseif (strcmp (e, ".mat"))
73 w.mat{end+1} = n; 73 w.mat{end+1} = n;
74 elseif (strcmp (n(1), "@")) 74 elseif (strcmp (n(1), "@") && isdir (n))
75 w.classes{end+1} = n; 75 w.classes{end+1} = n;
76 endif 76 endif
77 endif 77 endif
78 endfor 78 endfor
79 79