While using the Debian installer in low-memory mode to put a Debian system onto a NSLU2 (ARM processor with 32MB RAM), I noticed that the installer seemed slow. Running "ps" repeatedly in a concurrent session, I often saw about 80 processes per second, and many command lines of the form: [ <package1> = <package2> ] which tests if two package names are the same. I'm guessing that this is to construct a set represented as a list, such as a list of required packages with no duplicates. Doing this sequentially takes quadratic time. If '[' is built in to the shell, then it can be fast enough anyway.
Unfortunately, in the low memory installer '[' is not a shell builtin. '[' is a tracked alias to /usr/bin/[ which is in busybox. Therefore, there is a complete fork+exec for each '[' command. This is slow enough to cause a delay of many seconds each time the installer manipulates the list containing hundreds of packages. A faster way to manipulate such a list is to build it as lines in a file: rm -f list_1; > list_1 # create empty list rm -f list_1; touch list_1 # create empty list echo "$i" >>list_1 # add element to list [echo is builtin] grep -q "^$i\$" list_1 # test for membership cat list_1 # retrieve the list rm -f list_1 # destroy the list Perhaps even faster is to use filenames in a temporary directory: rm -f /tmp/list_1; mkdir -p /tmp/list_1 # create empty set > /tmp/list_1/"$i" # add element to set (no test needed!) touch /tmp/list_1/"$i" # add element to set (no test needed!) [ -e /tmp/list_1/"$i" ] # test for membership ls /tmp/list_1 # retrieve the set rm -rf /tmp/list_1 # destroy the set -- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]