busybox/debootstrap inefficienties (was Re: #103302 ask permission before erasing /var/cache/apt/archives)
Chris Tillman wrote:
> Pkg download approx. md5sum wc -c
> ------ --------------- ------ -----
> libc6 55 sec 15 sec 1 min 19 sec
> dpkg 18 sec 5 sec 25 sec
> I have no idea why the sums and wc take so long on that machine in the
> installer. Must be some effect of the reduced libraries. If I do the
> same operations in a booted Linux system on that machine, they take
> around a second or so. I also checked it in the installer system on my
> iMac, and it's pretty much instant there too.
Good job of gathering data. Busybox wc does indeed have some severe
efficiency problems, it seems:
joey@silk:~>time busybox wc -c bigfile
1.63user 0.04system 0:01.67elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (113major+15minor)pagefaults 0swaps
joey@silk:~>time wc -c bigfile
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (113major+13minor)pagefaults 0swaps
This is a p2 400, I'm sure it's much worse on a pentium or 486.
According to strace, busybox wc -c reads in the whole file in 4096 byte
chunks. On the other hand, gnu wc -c just stats the thing, which is
obviously tons more efficient.
see shy jo