Hello everybody,
I'm new with PB-Windows-programming. And I have a big question and I hope you can help me. I wrote a simple program like this one:
--------------------------------------------
DIM t AS SINGLE
DIM i AS LONG
t = TIMER
CLS
FOR i = 0 TO 1000000
LOCATE 5,5
PRINT STR$(i);
NEXT
t = TIMER - t
PRINT "Duration (sec.): " + STR$(ROUND(t,4))
END
--------------------------------------------
I compiled it with 2 different compilers:
PB/DOS 3.2, PB/CC 5
Then I execute both programs under WindowsXP.
PB/DOS (not compiled, only started in the IDE) takes about 0.9 secondes.
PB/CC-compiled EXE takes about 47 secondes.
I searched the PB-forum and then I found the Thread 15425:
If I replace the LOCATE and PRINT statements by the Function FPrint (please see the thread 15425: http://www.powerbasic.com/support/pb...ad.php?t=15425), which uses API-statements, then the PB/CC-exe speeds up to about 18.5 seconds. Very nice (it's faster for three times), but why? And why isn't it so fast like the DOS-version with the PRINT-commands? I don't know, if there are any disadvantages of using the API-calls instead of the PB-PRINT-commands?
So finally my big question is: why are Windows-console-applications sooooooooooo slowly in printing text on the console. And why are DOS-applications soooo fast?! I can't understand it.
And: do you know a solution, how to accelerate the console-output in PB/CC-programs to the DOS-speed? Is there any possibility or is it a Windows-bug?
Thank you very much in advance!
Nice greetings,
Max
I'm new with PB-Windows-programming. And I have a big question and I hope you can help me. I wrote a simple program like this one:
--------------------------------------------
DIM t AS SINGLE
DIM i AS LONG
t = TIMER
CLS
FOR i = 0 TO 1000000
LOCATE 5,5
PRINT STR$(i);
NEXT
t = TIMER - t
PRINT "Duration (sec.): " + STR$(ROUND(t,4))
END
--------------------------------------------
I compiled it with 2 different compilers:
PB/DOS 3.2, PB/CC 5
Then I execute both programs under WindowsXP.
PB/DOS (not compiled, only started in the IDE) takes about 0.9 secondes.
PB/CC-compiled EXE takes about 47 secondes.
I searched the PB-forum and then I found the Thread 15425:
If I replace the LOCATE and PRINT statements by the Function FPrint (please see the thread 15425: http://www.powerbasic.com/support/pb...ad.php?t=15425), which uses API-statements, then the PB/CC-exe speeds up to about 18.5 seconds. Very nice (it's faster for three times), but why? And why isn't it so fast like the DOS-version with the PRINT-commands? I don't know, if there are any disadvantages of using the API-calls instead of the PB-PRINT-commands?
So finally my big question is: why are Windows-console-applications sooooooooooo slowly in printing text on the console. And why are DOS-applications soooo fast?! I can't understand it.
And: do you know a solution, how to accelerate the console-output in PB/CC-programs to the DOS-speed? Is there any possibility or is it a Windows-bug?
Thank you very much in advance!
Nice greetings,
Max
Comment