bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm using floating point


From: Jim Meyering
Subject: Re: rm using floating point
Date: Thu, 25 Apr 2002 18:41:39 +0200
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu)

Andi Kleen <address@hidden> wrote:
> While debugging an operating system kernel I noticed that the first
> program using floating point in a typical linux startup is rm. This
> seems to be used for the hash table sizing of the hash table to detect
> loops in recursive rm, which is initialized in all cases even for non
> recursive rm.
>
> To speed up/clean up rm minimally I would suggest:
> - only initialize the hash table when recursive rm is requested.

Thanks for the suggestion!

> - use a default size for the hash table and do not use floating point to
> set it up.

Is it really worth worrying about whether rm performs a few floating
point operations?  Yes, we could avoid them pretty easily, but is it
worthwhile?

> Also I think there are better algorithms to detect loops than this which
> do not need such a complicated hash table. One nice way is to just keep
> a running counter of all files deleted and set a mark in a stack for
> each power of two crossed in the counter. Then check the current file
> always against the mark. This is guaranteed to detect every loop,
> although a bit lazily.

Good idea!
I've implemented it for the next test release.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]