Ok, this is probably just a nit, but if chunksize ever got small, or
namelist was really big, it could make a difference, so...
Could you change 686-687 to be:
nameslice = namelist[chunksz:]
del nameslice[chunksz:]
and set chunksz to be -101 instead of 100?
Here's why:
def f(lst):
... while lst:
... a = lst[:100]
... del lst[:100]
def g(lst):
... while lst:
... a = lst[-101:]
... del lst[-101:]
timeit.Timer("<func>(l)","from __main__ import <func>; l =
range(0,X)").timeit()
Time in secs to run for different values of X
X f g
1000 0.23 0.24
10000 0.23 0.23
100000 0.30 0.21
1000000 3.30 0.22
10000000 120+ 0.36
Thanks,
Brock
[email protected] wrote:
On Wed, Dec 02, 2009 at 02:55:00PM -0800, Brock Pytlik wrote:
If the bug was that mxfr might never get set to false, then this
LGTM. If not, then I didn't understand the fix and I'll have to try
again.
Yes, essentially. The mxfr object keeps track of what was requested for
the transfer. When a manifest is successfully downloaded, it's removed
from the object. When all manifests are successfully downloaded, the
object is empty and returns false. The other code escapes from this
loop by raising an exception once we've hit the maximum number of
retries. Since this code doesn't retry, and doesn't raise an exception
on transient failures, it was looping indefinitely.
One question, is namelist likely to be short, or might it be several
hundred, or several thousand members long?
This depends entirely on how many packages are being installed. If
you're installing one package, it'll have one item. If you're
installing slim_install, it'll have about 650 items.
-j
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss