[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
optimization: do not repeatedly use dup()
From: |
Ralf Wildenhues |
Subject: |
optimization: do not repeatedly use dup() |
Date: |
Thu, 12 May 2005 13:58:30 +0200 |
User-agent: |
Mutt/1.4.1i |
Why does the shell snippet
exec 5>file
echo foo >&5
echo bar >&5
cause repeated dup()ing and close()ing of the file descriptor instead of
a simple write() to the already open file descriptor, as pointed out in
[1]?
Looks like a simple optimization to avoid 2 of 3 syscalls (disclaimer: I
have not looked at the bash source code at all).
Regards,
Ralf
[1] http://lists.gnu.org/archive/html/bug-libtool/2005-05/msg00150.html
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- optimization: do not repeatedly use dup(),
Ralf Wildenhues <=