Command line LOADBTM

May 20, 2008
11,285
95
Syracuse, NY, USA
Would this be possible (in a future version) ... A command line version of
LOADBTM (or another name) together with UNLOADBTM and RUNBTM?

The user could

LOADBTM file.btm

and run it at will with RUNBTM, unloading it at an appropriate time.

This would make speed testing more critical. For example, instead of

timer & for /l %z in (1601,1,2008) agetodate.btm %@makeage[%z-01-01] & timer

one could

loadbtm agetodate.btm
timer & for /l %z in (1601,1,2008) runbtm %@makeage[%z-01-01] & timer

Without having to load (actually read) the BTM with each iteration, the timing
would more accurately show the significance of any tweaks.
--
- Vince
 

rconn

Administrator
Staff member
May 14, 2008
12,315
148
vefatica wrote:

> Would this be possible (in a future version) ... A command line version of
> LOADBTM (or another name) together with UNLOADBTM and RUNBTM?
>
> The user could
>
> LOADBTM file.btm
>
> and run it at will with RUNBTM, unloading it at an appropriate time.
>
> This would make speed testing more critical. For example, instead of
>
> timer & for /l %z in (1601,1,2008) agetodate.btm %@makeage[%z-01-01] & timer
>
> one could
>
> loadbtm agetodate.btm
> timer & for /l %z in (1601,1,2008) runbtm %@makeage[%z-01-01] & timer
>
> Without having to load (actually read) the BTM with each iteration, the
> timing would more accurately show the significance of any tweaks.

It would require rewriting the batch parser. I'm a bit dubious that
marginally more precise loop timing tests are worth a couple of weeks of
development time (that could be spent on more widely useful features),
but I'll add it to the suggestion list.

It could be done in a plugin, if you don't mind writing your own parser ...

Rex Conn
JP Software
 
May 20, 2008
11,285
95
Syracuse, NY, USA
On Wed, 04 Jun 2008 22:53:33 -0500, you wrote:


>> loadbtm agetodate.btm
>> timer & for /l %z in (1601,1,2008) runbtm %@makeage[%z-01-01] & timer
>>
>> Without having to load (actually read) the BTM with each iteration, the
>> timing would more accurately show the significance of any tweaks.


>It would require rewriting the batch parser.

That surprises me. As I see it (from the outside) you already have a mechanism
for reading a BTM into memory and then running it. I was thinking you could
just separate those two chores and leave the BTM in memory.
--
- Vince
 

rconn

Administrator
Staff member
May 14, 2008
12,315
148
vefatica wrote:


> Quote:
> >> loadbtm agetodate.btm
> >> timer & for /l %z in (1601,1,2008) runbtm %@makeage[%z-01-01] & timer
> >>
> >> Without having to load (actually read) the BTM with each iteration, the
> >> timing would more accurately show the significance of any tweaks.
>
>
> Quote:
> >It would require rewriting the batch parser.
>
> That surprises me. As I see it (from the outside) you already have a
> mechanism for reading a BTM into memory and then running it. I was
> thinking you could just separate those two chores and leave
> the BTM in memory.

It's the "just separate those two chores" part that would require
rewriting the parser. And if you (1) tried to run another batch file
after the loadbtm and before the unloadbtm, or (2) called or chained to
another batch file from the first one, it would require the DWIM parser.

Rex Conn
JP Software
 
May 20, 2008
11,285
95
Syracuse, NY, USA
On Wed, 04 Jun 2008 23:26:15 -0500, you wrote:


> > thinking you could just separate those two chores and leave
> > the BTM in memory.
>
>It's the "just separate those two chores" part that would require
>rewriting the parser. And if you (1) tried to run another batch file
>after the loadbtm and before the unloadbtm, or (2) called or chained to
>another batch file from the first one, it would require the DWIM parser.

I figured (1) would be a no-no or would cause an auto-unloading. For me,
calling and chaining could be simply disallowed, or cause a reversion to normal
behavior. If I wanted to do testing that specific, I'd just do without calling
and chaining (neither or which I use much anyway).

A question: In tweaking that BTM I sent, I noticed that extra space (comments,
blank lines) resulted in significantly slower tests. No doubt they affect the
load time. Are they kept in memory or discarded when a BTM is loaded?
--
- Vince
 
May 30, 2008
120
1
On 05/06/2008, vefatica <> wrote:

> This would make speed testing more critical. For example, instead of
>
> timer & for /l %z in (1601,1,2008) agetodate.btm %@makeage[%z-01-01] & timer
>
> one could
>
> loadbtm agetodate.btm
> timer & for /l %z in (1601,1,2008) runbtm %@makeage[%z-01-01] & timer
>
> Without having to load (actually read) the BTM with each iteration, the timing
> would more accurately show the significance of any tweaks.

Could you not add

timer & for /l %z in (1601,1,2008) gosub main %@makeage[%z-01-01] & timer
quit
:main [arg]

at the top of your file, plus a return at the end, to get effectively
the same test precision, without any changes to TCMD?

Paul.
 

rconn

Administrator
Staff member
May 14, 2008
12,315
148
vefatica wrote:


> A question: In tweaking that BTM I sent, I noticed that extra space
> (comments,
> blank lines) resulted in significantly slower tests. No doubt they
> affect the
> load time. Are they kept in memory or discarded when a BTM is loaded?

They are not discarded as this would require a preparser pass. (The
batch file is loaded as a block, not line-by-line.)

If you run BATCOMP it will remove blank lines and "::" comments from the
target.

Rex Conn
JP Software
 

samintz

Scott Mintz
May 20, 2008
1,488
15
Solon, OH, USA
I don't suppose there's a back-door way to pass an open file handle to the
batch engine? I was thinking that Vince's MMF plugin could be easily
enhanced to load the batch file and pass the memory mapped file to the
parser.

-Scott




rconn <>
06/04/2008 11:53 PM
Please respond to



To
Samintz@ra.rockwell.com
cc

Subject
RE: [Support-t-136] Command line LOADBTM






vefatica wrote:

Quote:

> Would this be possible (in a future version) ... A command line version
of

> LOADBTM (or another name) together with UNLOADBTM and RUNBTM?
>
> The user could
>
> LOADBTM file.btm
>
> and run it at will with RUNBTM, unloading it at an appropriate time.
>
> This would make speed testing more critical. For example, instead of
>
> timer & for /l %z in (1601,1,2008) agetodate.btm %@makeage[%z-01-01] &
timer

>
> one could
>
> loadbtm agetodate.btm
> timer & for /l %z in (1601,1,2008) runbtm %@makeage[%z-01-01] & timer
>
> Without having to load (actually read) the BTM with each iteration, the
> timing would more accurately show the significance of any tweaks.
It would require rewriting the batch parser. I'm a bit dubious that
marginally more precise loop timing tests are worth a couple of weeks of
development time (that could be spent on more widely useful features),
but I'll add it to the suggestion list.

It could be done in a plugin, if you don't mind writing your own parser
...

Rex Conn
JP Software
 
May 20, 2008
3,515
4
Elkridge, MD, USA
p.f.moore wrote:
| On 05/06/2008, vefatica <> wrote:
|
|
| ---Quote---
|| This would make speed testing more critical. For example, instead of
||
|| timer & for /l %z in (1601,1,2008) agetodate.btm
|| %@makeage[%z-01-01] & timer
||
|| one could
||
|| loadbtm agetodate.btm
|| timer & for /l %z in (1601,1,2008) runbtm %@makeage[%z-01-01]
|| & timer
||
|| Without having to load (actually read) the BTM with each iteration,
|| the timing would more accurately show the significance of any tweaks.
| ---End Quote---
| Could you not add
|
| timer & for /l %z in (1601,1,2008) gosub main %@makeage[%z-01-01] &
| timer quit
|| main [arg]
|
| at the top of your file, plus a return at the end, to get effectively
| the same test precision, without any changes to TCMD?

Variations on the same theme:

1/ Perform the GOSUB above once for an arbitrary parameter to ensure it is
preparsed

2/ Perform the GOSUB above for a set of handcrafted parameters that exercise
each branch at least once

3/ eliminate the @makeage by building a table of value to use

To just compare the execution time of two variants of the same code snippet
you should execute just the snippets 1,000 times (or 10,000 times) each with
unchanging parameters. If there are branches in the snippets, you need to
time them separately for each possible path. In the end you can come of with
a worst-case timing.

--
Steve
 
Similar threads
Thread starter Title Forum Replies Date
vefatica `Back quotes` - command line vs. batch file Support 5
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 7
Phileosophos Command-line Editing Shortkeys That Fail Support 6
D Open Windows 10 Photos app from command line Support 11
fpefpe How to? command echo in title line/bar Support 2
vefatica Command line DO with no closing parenthesis? Support 9
R Long commands retrieved from command history have blank line when wrapped Support 20
D Double Quote in TC Tool Bar Button Command line Support 3
Joe Caverly Expand all aliases on the command line Support 2
Jay Sage Cannot Postion Cursor in Command Line Using Mouse Support 7
vefatica IDE.EXE's command line? Support 19
D btm file command line augments comparing for string or math. Support 12
P Escape key no longer clears command line in v24 Support 21
J File explorer handling from command line? Support 2
M Ctrl-C when using command line history does nothing Support 2
M Command line parsing differences between cmd.exe and TCC Support 6
C Replace 1st argument on command line Support 4
K Command Line Selection Not Working Support 12
J Error running Python at command line Support 9
rps How to? Alias/Command line use of *log on/off Support 2
x13 //directive ignored on TCC command-line Support 4
J How to? max. practical command line length? Support 3
mfarah WAD Odd behaviour with command-line arguments on TCMD. Support 7
thorntonpg F1 on command line The webpage cannot be found Support 5
J Python: TCC command line parsing removes '=' equal sign characters Support 4
L Fixed console line length in Take Command 19? Support 3
C LOG entry for TCMD/TCC command line Support 15
H command line parsing question Support 5
Joe Caverly How to? Date Range in command line for 7zip /= Support 1
cgunhouse One of the Focuses of V17 Beta Testing Should Be Command Line Parsing Support 1
cgunhouse Jabber Command Line Option Being Transmitted -- Fixed with Build 42 Support 2
M Hotkey-mechanism, for doing something with the current command-line Support 4
J Passing % character through command line to .btm Support 5
vefatica Command line SETLOCAL? Support 11
tmaynard How to? Control-U alias for Escape (command line editing) Support 5
BobK How to? Handling filenames with blanks at command line Support 3
CWBillow Send Command-line with prompt? Support 6
M Missing PERL command-line arguments Support 1
fpefpe WAD Python support does not process command line Support 14
vefatica SENDMAIL, command line override SMTP server? Support 2
vefatica (OT) Show desktop from command line? Support 20
M Starting Windows GUI programs from the command line... Support 10
A How to? Remove last argument on command line Support 4
nickles Reload tcmd.ini from the command line Support 11
A How to? Invoke View Clipboard from command line Support 8
ehab aboudaya How to? activate tab with same directory in command line Support 6
A minor documentation fix - command line editing Support 0
A Minor documentation fix ["-" on command line] Support 3
A WAD BOM printed on command line from BAT file Support 5
J command line cursor keeps reverting to overstrike Support 6

Similar threads