Library functions and line continuations?

May 20, 2008
Syracuse, NY, USA
Below, it looks like the function "rv" didn't make it from file to memory correctly.
g:\tc23\library> head /n5 iprocessline.txt
rv {
echo foo ^
bar ^

g:\tc23\library> library /r iprocessline.txt /u

g:\tc23\library> library /f rv
rv {
May 20, 2008
Syracuse, NY, USA
LIBRARY /R doesn't support line continuations (it slows things down significantly).

Why would you want to do that?
Why would I want to do what ...

... slow things down significantly? ... I don't want to do that.

... use line continuations? ... because they make editing easier (especially when using TPIPE with several actions).
May 20, 2008
Syracuse, NY, USA
LIBRARY /R doesn't support line continuations (it slows things down significantly).
I did some testing and I'm not sure about the "significantly" part. Using BTMs and a rather outrageous example (one line vs. that line broken into 27 pieces, see below) I see a difference in time of about 1% (to both read it into memory and execute it). I suppose the same could be true of library functions if they allowed continued lines.
v:\> type fast.btm
1>nul echo abcdefghijklmnopqrstuvwxyz
v:\> type fast2.btm
1>nul echo ^

v:\> timer & do i=1 to 10000 ( fast.btm ) & timer
Timer 1 on: 14:03:34
Timer 1 off: 14:03:47  Elapsed: 0:00:13.18

v:\> timer & do i=1 to 10000 ( fast2.btm ) & timer
Timer 1 on: 14:03:47
Timer 1 off: 14:04:00  Elapsed: 0:00:13.34


Staff member
May 14, 2008
Your tests are unfortunately not relevant, because you're not measuring what you think you are.

Batch files are (already) read a line at a time; what you're measuring is how long it take to assemble a (really small) line. The LIBRARY /R reads a block at a time and stuffs it in memory, without going through all the line parsing. For a 100 byte file, you won't see any difference; for a 500K file (and yes, there are some users out there with alias & library files that size) it's a sizeable difference.
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly @NAME supports library functions Support 2
D Version 28 LIBRARY changes have side effects Support 3
Joe Caverly LIBRARY /F in v28 Support 0
Joe Caverly LIBRARY and Pipes Support 2
Joe Caverly How to? Get name of current LIBRARY function? Support 4
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
Joe Caverly No blank line in TEXT...ENDTEXT in a LIBRARY function Support 8
cgunhouse Ctrl-C from within a library function Support 6
vefatica Continued lines (^) in a library routine? Support 5
vefatica LIBRARY and file name completion? Support 4
vefatica '}' in a library function? Support 3
Joe Caverly Update ENDLOCAL to include LIBRARY Support 0
Joe Caverly Debugging a LIBRARY function Support 10
J Documentation Make tcc great again - what's the benefit of LIBRARY? Support 6
A Problem with functions @int @decimal and identifying Powershell as a shell. Support 12
Joe Caverly "Functions" in cmd.exe batch files Support 6
Charles Dye Documentation Help Nits Forever: Checksum functions Support 0
Joe Caverly SETLOCAL removes Aliases and Functions Support 3
Charles Dye Functions which no-one has ever tried to use.... Support 5
vefatica WHICH and @functions Support 2
vefatica Two @FUNCTIONs/aliases with the same name Support 4
M Keywords for commands, functions, internal variables Support 3
C Documentation near or fully obsolete functions Support 7
Charles Dye Optional F parm in checksum functions Support 0
C coding functions and subroutines Support 9
rps Functions @year[date] @isowyear[date] help Support 7
mikea How to? TCC and XMLnodes/XMLxpath functions Support 0
Dan Glynhampton Are these two functions the same? Support 2
M How to? Logic in functions... Support 5
A WAD function return values with parentheses prevent evaluation of additional functions Support 31
M "History" command not giving me what I want when executed by @Exec... functions... Support 6
Charles Dye Web help on functions Support 2
samintz Help examples for the @ISxxx functions Support 3
R specific functions for number conversion Support 2
C Unsuppressable errors from XML functions Support 5
nikbackm Checksum functions Support 4
J TCC Out of memory with aliases and functions Support 5
Peter Bratton Disappearing functions Support 1
A I dont see anything in the alias/functions/batchvariables tabs in IDE Support 13
dcantor Comments and suggestions on functions for binary buffers Support 4
C blank line in copy ... results Support 9
old coot LEAVE appears to affect command-line arguments Support 11
T VIEW only works from command line Support 14
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 8
Phileosophos Command-line Editing Shortkeys That Fail Support 6
D How to use multi-line DO to loop through first level directory names Support 5
D Open Windows 10 Photos app from command line Support 11
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
Jesse Heines Strange Line Wrapping Behavior Support 14

Similar threads