- May 20, 2008
I have a little app which spits out all the permutations of the characters in its input string. The program uses a single printf() statement. Printing the output is, of course, slow (e.g., there are 3268800 permutations of 10 characters). If I pipe my app to another, it runs in the same time it would if it were not outputting at all. For example,
But if I redirect its output to NUL, it takes a lot longer.
This slowness of redirection to NUL does not seem to affect TCC's internal commands. So that makes me wonder if anything can be done to speed it up ... either by TCC, or by my app itself ... maybe by changing the properties of stdout (or something like that).
l:\projects\perms\release> timer & perms.exe abcdefghij | wc -l & timer Timer 1 on: 12:51:56 3628800 Timer 1 off: 12:51:57 Elapsed: 0:00:01.44
l:\projects\perms\release> timer & perms.exe abcdefghij > nul & timer Timer 1 on: 12:53:19 Timer 1 off: 12:53:46 Elapsed: 0:00:26.82