
Win95/98 Console Print Speed Problem: SOLVED!
To All PB/CC Users:
The holiday season is approaching fast... Here's an early "present" from
Perfect Sync Software, the publishers of Console Tools
( http://www.*-*-*.com/ ).
Everybody knows that the Windows 95 Console has a problem with PRINT
speed. And if you've installed Windows 98, you know that Microsoft
hasn't fixed the problem.
Well, finally, after a lot of experimentation, we've found a simple
solution!
All you have to do is change the size of the console window, and the
PRINT speed problem goes away instantly! The Win95/98 console window is
only slow when it has 25, 43, or 50 rows.
All other console buffer sizes are between 10 and 50 times as fast as
25/43/50, depending on the machine!
There's a hitch, of course. If you use the console window's Property
menu to change the size of the console, Windows 95 and 98 only allow you
to select 25, 43, and 50 rows. But it *is* possible for your PB/CC
programs to *programmatically* change the size of the console window.
To be honest, it wouldn't hurt our feelings (at all!) if you used our
Console Tools DLL to change the console window's size, but here's the
source code for a small program that demonstrates how you can use the
Win32 API to change a PB/CC program's console window from 25 to 26 lines.
Happy holidays, and use it in good health!
-- Eric Pearson, Perfect Sync Software
P.S. Please post your results as a response to this message!
(Console Tools, a PB/CC add-on, contains over 60 console related
functions including a simple-to-use function that allows you to change
the size of the console window to virtually any size. To download our
demo program, visit PerfectSync.com.)
'-------------------------------------------------------
'This first block of code is from the WIN32API.INC file.
TYPE SMALL_RECT
xLeft AS INTEGER
xTop AS INTEGER
xRight AS INTEGER
xBottom AS INTEGER
END TYPE
DECLARE FUNCTION SetConsoleWindowInfo LIB "KERNEL32.DLL" _
ALIAS "SetConsoleWindowInfo" _
(BYVAL hConsoleOutput AS LONG, _
BYVAL bAbsolute AS LONG, _
lpConsoleWindow AS SMALL_RECT) AS LONG
DECLARE FUNCTION SetConsoleScreenBufferSize LIB "KERNEL32.DLL" _
ALIAS "SetConsoleScreenBufferSize" _
(BYVAL hConsoleOutput AS LONG, _
BYVAL dwSize AS LONG) AS LONG
'-------------------------------------------------------
FUNCTION PBMain
DIM Rect AS LOCAL SMALL_RECT
DIM spStart AS LOCAL SINGLE
DIM spTest1 AS LOCAL SINGLE
DIM spTest2 AS LOCAL SINGLE
DIM lRow AS LOCAL LONG
DIM lCol AS LOCAL LONG
'Fill 20 rows with dashes and time how long it takes...
spStart = TIMER
FOR lRow = 1 TO 20
FOR lCol = 1 TO 80
PRINT "-";
NEXT
NEXT
spTest1 = TIMER - spStart
'--------------------------------------------------
'This code changes the console window to 80x26...
SetConsoleScreenBufferSize GETSTDOUT, MAKDWD(80,26)
Rect.xBottom = 25
Rect.xRight = 79
SetConsoleWindowInfo GETSTDOUT, 1, Rect
'--------------------------------------------------
'Now repeat the test using plus signs...
LOCATE 1,1
spStart = TIMER
FOR lRow = 1 TO 20
FOR lCol = 1 TO 80
PRINT "+";
NEXT
NEXT
spTest2 = TIMER - spStart
'Display the results...
PRINT
PRINT "Elapsed Time with 25 rows = ";
PRINT FORMAT$(spTest1,"##.##");" seconds."
PRINT "Elapsed Time with 26 rows = ";
PRINT FORMAT$(spTest2,"##.##");" seconds."
PRINT "Difference in print speed = ";
PRINT FORMAT$(spTest1-spTest2,"##.##");" seconds."
PRINT "That's a `speedup ratio' of ";
PRINT FORMAT$(spTest1/spTest2,"##.##");" (1.00 = no difference)"
WAITKEY$
END FUNCTION