repl.bat discussion

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

repl.bat discussion

#1 Post by dbenham » 22 Dec 2013 20:56

Blyanadams wrote:
dbenham wrote:But, when I say this method is fast, I mean it is fast for processing large amounts of data. There is significant CSCRIPT start-up time that makes this method relatively slow for a single line of input.

Dave Benham

inside repl.bat its calling cscript as well, so does it matter its single line input or many?

It only calls CSCRIPT once per instantiation of REPL.BAT, but once started, it can process many lines very quickly.


Dave Benham

Blyanadams
Posts: 23
Joined: 20 Dec 2013 05:41

Re: Protect ! and ^ within FOR /F when delayed expansion ena

#2 Post by Blyanadams » 22 Dec 2013 21:10

dbenham wrote:It only calls CSCRIPT once per instantiation of REPL.BAT, but once started, it can process many lines very quickly.
Dave Benham


can you do a benchmark ?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Protect ! and ^ within FOR /F when delayed expansion ena

#3 Post by foxidrive » 22 Dec 2013 21:32

A benchmark against what, is the question I'd ask

You can also do a benchmark yourself to check the speed.
I know that reports state that it's very very quick compared to plain batch.

`repl.bat` - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat
It's the same version that is on dostips - it's the quickest link to the file that I have to hand.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: repl.bat discussion

#4 Post by foxidrive » 23 Dec 2013 10:27

Thanks to Ed Dyreen and penpen for your patience in this topic. I've removed the posts that followed as I have doubts that the questions are genuine.

Blyanadams, if you want to compare the speed of repl.bat vs batch code then it's not hard to run some tests, come back with your code and results and
continue the discussion in a technical manner.

Blyanadams
Posts: 23
Joined: 20 Dec 2013 05:41

Re: repl.bat discussion

#5 Post by Blyanadams » 23 Dec 2013 18:09

foxidrive wrote:Thanks to Ed Dyreen and penpen for your patience in this topic. I've removed the posts that followed as I have doubts that the questions are genuine.

Blyanadams, if you want to compare the speed of repl.bat vs batch code then it's not hard to run some tests, come back with your code and results and
continue the discussion in a technical manner.


foxidrive, why did you remove my posts?
they are all genuine questions! And no one answered my question to my satisfaction.

The question i asking is regarding what dbenham says.!
dbenham wrote:There is significant CSCRIPT start-up time that makes this method relatively slow for a single line of input.


Why is there cscript load time for single input line that is slow? Both methods , input single line and large file , calls the CSCRIPT engine! Both have load times!

Until he try to clarify my question, i don't think anyone who answers on behalf knows whats going on, so how can you blatantly remove my posts?!

Dbenham proclaims there is significant load time for CSCRIPT engine, so i asked him to do a benchmark to show what he says is true. IS that wrong? Isn't it like saying i ask a question, and you reply "search google"?

Aacini
Expert
Posts: 1927
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: repl.bat discussion

#6 Post by Aacini » 23 Dec 2013 20:52

Brian Adams wrote:The question i asking is regarding what dbenham says.!
dbenham wrote:There is significant CSCRIPT start-up time that makes this method relatively slow for a single line of input.


Why is there cscript load time for single input line that is slow? Both methods , input single line and large file , calls the CSCRIPT engine! Both have load times!


When a VBScript/JScript program is executed, CSCRIPT.EXE engine is loaded in order to "compile" the VBScript/JScript source program. Of course, this load time is the same at all times, but if the program is used to process a large amount of input data, the CScript.exe load time is not significant. On the other hand, if the processed input data is very short (like a single input line), then the CScript.exe load time may be even larger than the time required to process the input data itself. In this case, the "CScript load time" becomes very significant (another word to state this point, is "slow"). This is not matter of a benchmark, but of common sense. However, if you have problems to understand this point, I may guide you on a "virtual test" that may clear this matter.

Antonio

Blyanadams
Posts: 23
Joined: 20 Dec 2013 05:41

Re: repl.bat discussion

#7 Post by Blyanadams » 23 Dec 2013 21:08

thanks for answering. Your answer is more like it. I am able to understand quite a bit!
Aacini wrote:When a VBScript/JScript program is executed, CSCRIPT.EXE engine is loaded in order to "compile" the VBScript/JScript source program. Of course, this load time is the same at all times, but if the program is used to process a large amount of input data, the CScript.exe load time is not significant.

yes, that's what I am asking all along.

Aacini wrote:On the other hand, if the processed input data is very short (like a single input line), then the CScript.exe load time may be even larger than the time required to process the input data itself.

why? this is the part I don't understand. Whether its just one line to change case

Code: Select all

echo "my string" | repl "\s+s" " S"  

or loading a whole file

Code: Select all

type file | repl "...." 

they both will load the CSCRIPT engine because like you said, CSCRIPT is going to compile the JSCRIPT source. 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) ?

Aacini wrote:In this case, the "CScript load time" becomes very significant (another word to state this point, is "slow"). This is not matter of a benchmark, but of common sense. However, if you have problems to understand this point, I may guide you on a "virtual test" that may clear this matter.
Antonio


Please do. Maybe I should have phrase it better. There's no need to do actual benchmark. I just want to know, if you
are going to show people the running times of loading a single line to "repl" vs a whole file, how would you go about doing it? What tools would you use to determine that indeed , what you mean by CSCRIPT "load time" is much faster for a whole file than a single line.

thanks
(PS is that techinical enough to be considered a genuuine discussion? )

Aacini
Expert
Posts: 1927
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: repl.bat discussion

#8 Post by Aacini » 23 Dec 2013 23:27

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...

Blyanadams
Posts: 23
Joined: 20 Dec 2013 05:41

Re: repl.bat discussion

#9 Post by Blyanadams » 23 Dec 2013 23:46

Aacini wrote: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.

yes, pardon me for the misrepresentation. Yes i am talking about the engine processing the jscript code which is "inside repl". hence the way i put it.

For the rest of the points in your reply, i definitely know what you are talking about but that's not what I am asking. I am only asking on the "start up" time of the CSCRIPT engine (as what dbenham mentioned), NOT DATA PROCESSING part.
what can you interpret from this statement
dbenham wrote:There is significant CSCRIPT start-up time that makes this method relatively slow for a single line of input.

no where it mention processing time. dbenahm just say, "CSCRIPT startup-time".
to me, CSCRIPT start up time should be both similar! (I am again not talking about processing time)

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: repl.bat discussion

#10 Post by dbenham » 24 Dec 2013 00:23

Blyanadams wrote:what can you interpret from this statement
dbenham wrote:There is significant CSCRIPT start-up time that makes this method relatively slow for a single line of input.

no where it mention processing time. dbenahm just say, "CSCRIPT startup-time".
to me, CSCRIPT start up time should be both similar! (I am again not talking about processing time)

Of course the start up time is similar (identical really). You are completely misunderstanding my intended meaning, as well as failing to grasp good explanations from others.

I'll make one attempt to explain, then I am finished.

What I was implying is that it may not be worth the time invested in the slow start up if all you are doing is processing a single line of input. But it is definitely worth waiting for the slow start up if you are going to process many lines, since the line processing is very fast once start up is complete, and it only needs to start once.

Here is a simple analogy: Why wouldn't you drive a car to visit your neighbor 3 houses down a city block? One reason is you can probably walk there much faster because it takes significant time to get in your car, start it up, and park it and exit when done. But it is an entirely different story if you are visiting your friend 10 miles away across town. The time it takes to start up at the beginning and park at the end is inconsequential compared to the time saved driving 10 miles vs. walking 10 miles.


If you can't understand that concept, then I don't know what else to say. If you understand, but don't believe, then I suggest you run some timing experiments on your own.


Dave Benham

Blyanadams
Posts: 23
Joined: 20 Dec 2013 05:41

Re: repl.bat discussion

#11 Post by Blyanadams » 24 Dec 2013 00:34

dbenham wrote:Of course the start up time is similar (identical really). You are completely misunderstanding my intended meaning, as well as failing to grasp good explanations from others.

that's probably because you failed to explain like you explained (real well too) in this last post. As for others who tried to explain on your behalf, they are not helping at all because they don't understand what I am asking too.
Anyway, end of discussion. I am satisfied.

Post Reply