Brian Adams wrote:thanks for answering. Your answer is more like it. I am able to understand quite a bit!
. . . . .
For the change case example, CSCRIPT is going to be loaded to "compile" the arguments passed to repl. The same to a whole file. This is the "load" time I am talking about. Suffice to say, inside the CSCRIPT engine, how does it determine a single line input is "slow" vs when a whole file is processed (both via jscript) ?
You have a fundamental misunderstanding here. The CSCRIPT engine is
NOT used to "compile the arguments passed to repl". The CScript engine is used
exclusively to compile the JScript source code ("repl.bat" in this case), in the same way as any compiler of any programming language. You must note also that
the processing of the arguments themselves is very fast. In both
echo "my string" | repl "\s+s" " S" and
type file | repl "...." the
arguments are very short, so they are processed in a very fast way.
However, the
PROCESSED DATA have NO relation with the arguments. In the first example, the processed data is "my string" (9 characters long), whereas in the second example the processed data is
the contents of "file". I hope you understand that if "file" have a large amount of data, it takes more time to process than "my string" with no further explanation. For example, if "file" have 90 characters, it should take approximately 10 times more time to process than "my string" (9 characters). If "file" have 900 characters, it should take approximately 100 times more time to process than "my string". If "file" have 9000 characters, it should take 1000 times more time to process than "my string"... I am sorry, but if you can not understand this point, I have no other means to try to show you that, in the real world, the processing of a large amount of data takes more time than the processing of a small amount of data...
This way, if "repl.bat" program is used to process a large file, then the total elapsed time is hundred to thousand times larger than the time that the same program requires to process
one line of text, so the load time of CScript.exe program does not matter (it is not significant) when it is compared vs. the total time required to process a large file. However, if "repl.bat" program is used to process a single line of text, then the load time of CScript.exe program may take a significant part of the total time required to process the single line of text (because it is hundred to thousand times less time than the time required to process a large file). This way, if "repl.bat" is used to process a single line of text, it is "slow", but this point does not matter if "repl.bat" is used to process a large file...