[Top][All Lists]

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

rm using floating point

From: Andi Kleen
Subject: rm using floating point
Date: 21 Apr 2002 12:43:58 +0200


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.
- use a default size for the hash table and do not use floating point to
set it up.

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.

Version: fileutils 4.1


reply via email to

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