request for feature of pkg command
Francesco Potorti`
Potorti at isti.cnr.it
Fri Feb 1 09:57:43 CST 2008
When I was asking for a "require" argument to pkg, which would not
reload an already loaded package to save time, I got this answer from
Soren:
>>Can't you do something like:
>>
>>list = pkg("list");
>>for i = 1:length(list)
>> if (strcmp(list{i}.name, "image"))
>> printf("Yay, the image package is installed!!");
>> endif
>>endfor
Since I am using a function file which needs some packages and it is
slow because it loads them every time it is called, I went on to
implement his suggestion, hoping that one day it will be easier. Alas,
the above technique does not save any time. In fact, on my Debian 2x64
Athlon, pkg requires between 0.4 and 0.5 seconds either to load, unload
or generate a list of packages. Is this a bug?
If this is due to the fact that the filesystem must be scanned for every
pkg request, then it would be useful to have a list of *loaded* packages
as a variable.
octave3.0> t=cputime;pkg unload signal;cputime-t
ans = 0.49203
octave3.0> t=cputime;pkg load signal;cputime-t
ans = 0.44403
octave3.0> t=cputime;pkg load signal;cputime-t
ans = 0.41603
octave3.0> t=cputime;a = pkg list;cputime-t
ans = 0.40803
octave3.0> t=cputime;a = hamming(256);cputime-t
ans = 0.012001
Thanks to all of you for caring about Octave.
--
Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa Email: Potorti at isti.cnr.it
Web: http://fly.isti.cnr.it/ Key: fly.isti.cnr.it/public.key
More information about the Bug-octave
mailing list