- May
- 13,807
- 211
I asked about this a couple years ago but the discussion took a detour to third party apps and programming techniques. I'm not complaining but I'd like to understand why one example below (with the pipe) is faster than the other (with redirection). NOOP is a plugin.
Even WC.EXE, which has to count lines, words, and characters is a lot better than redirecting to NUL.
Code:
INT WINAPI NOOP ( LPWSTR psz )
{
return 0;
}
Code:
v:\> timer & dir /s c:\ > nul & timer
Timer 1 on: 00:23:54
Timer 1 off: 00:24:20 Elapsed: 0:00:26.24
v:\> timer & dir /s c:\ | noop & timer
Timer 1 on: 00:24:25
Timer 1 off: 00:24:41 Elapsed: 0:00:15.74
Code:
v:\> timer & dir /s c:\ | wc & timer
Timer 1 on: 00:31:27
Lines Words Chars
243897 987074 14151559
Timer 1 off: 00:31:43 Elapsed: 0:00:16.08