Performance *does* matter. I was working on speeding up gnome-terminal start. First I used
my own version of readahead (renamed to readlock) to mlock all required files into RAM. Then
it was still slower than xterm so I began stracing everything and I discovered that
gnome-terminal calls something like gnome-pty-helper, and that it does fork, then close 3-4096
(4096 was my max fd number), then pty-helper did it *again*.
I removed the close loop from pty-helper and also cut my max fds down to 256 and it was
noticably faster to start.
At any rate, using /proc and readdir to close only open fds is probably much faster than
blindly closing fds 3-256, let alone 3-4096.