> On Aug 13, 2016, at 4:31 AM, Connor Lane Smith <[email protected]> wrote: > > IO redirection being done by separate programs, though, seems like a > wrong decision. Streaming the data through a separate process is > considerably less efficient than just setting a file descriptor to an > open file, and not always equivalent in behaviour either. For example, > `tty < $TTY` is obviously very different to `cat $TTY | tty`. In my > opinion this is a bug in your design, and needs to be fixed. >
You make a good point about the effect, but I don't consider it a design flaw but a design effect. The same argument could be made for processes like grep. It would be much more efficient as a built-in, but it isn't a big deal most of the time. If we really want performance, we use another tool with built-in RE. Same case here: if I need to redirect gigabytes, I can use sh for that command. There are ways to speed it up using zero-copy interfaces from the OS, but people don't even do that with grep because if you are using shell, you are already trading development time for efficiency.
