TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ZACK JONES
from: BRIAN MCLAUGHLIN
date: 1995-10-21 10:31:00
subject: FDSTAT.BAS Source

ZJ>Here's the source for the fdstat program I'm using.  Any tips or hints to
ZJ>improve it would be greatly appreciated.
Because your code was so straightforward and easy to read, I don't want
to make any suggestions that would torture the readability and
maintainability just for the sake of half a second of execution time.
What I can give you is just a bit of pecking around the edges:
The first thing I noticed about your code is that it is making string
comparisons in the Select Case structure, which are comparatively slow.
Since a Select Case will break on the first successful comparison, I
would rearrange the order of the comparisons to put the most likely
matches at the top of the list, instead of "300 b" at the top. That's a
fairly harmless optimization that might gain you a few percent, without
sacrificing readable code.
I am assuming that FileHandle2 may at some point be modified to output
to a modem instead of a file. However, if you will always be reading
from a file and writing to a file, you can probably get a speed
increase by adding buffering to the line input from FileHandle1.
The simplest way to do this would be with PBFILES, which has a buffered
line input routine with a dynamically allocated buffer of any size you
specify, up to the max string segment size. Another easy way would be
to grap WINER.ZIP, the freeware version of Ethan Winer's BASIC Tips and
Techniques. It has a BufIn routine that you could apply to this code
quite simply. It's buffer is static and can't be deallocated, though,
so there is a penalty for setting a very large buffer.
Hope this helps.
 * SLMR 2.1a * MAXLIB For PB v1.2 - Access arrays and files in EMS/XMS!
--- WILDMAIL!/WC v4.12 
---------------
* Origin: NWCS Online (1:105/362.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.