I'm trying to get off GWBASIC on my XP computer. I'm running a job which reads a large text file sequentially.
Timings for same run: Native GWBASIC under XP --- 8.5 seconds.
Under PC-BASIC, 22 minutes, 32 seconds. What can I do to make it run faster? Is there a PC-BASIC compile option in the future? Even GWBASIC under DOSBox runs faster than PC-BASIC, though not much (18 minutes 54 seconds).
Thank you very much for any help. (By the way, I'm running PC-BASIC under Windows 10).
Tony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately PC-BASIC is slow; mostly because it runs in Python, which is itself an interpreted language. It also does a lot of work to conform closely to GW-BASIC in things like the string and floating-point representation, which means it cannot use the much faster native libraries for such things. PC-BASIC in DOSBox is indeed faster.
I've been focussing most on making the emulator faithful to GW-BASIC; performance has so far been an afterthought. I do have some ideas on how to make it faster, but they are still in early stages. There are also still a large number of issues to solve that affect the emulator's faithfulness, which may need to take priority over performance.
You could try to run the development pre-release version with the -n command-line option. This does away with the graphical interface completely and works more like a command-line filter. It's best suited for scripting and file processing, which seems to be what you're doing.
You can have both versions installed alongside each other. You may run into a few more bugs in the development version though - let me know if you do. Note that it may also well end up being slower - some of the code in that version still needs some work.
Building a compiler is a nice thought, but it would be a fairly large and almost completely separate project. I'm afraid I don't see it happening anytime soon...
Have you tried the free compilers FreeBASIC or QB64 ? They are compatible with QuickBASIC 4.5 and support line numbers and some of the GW-BASIC syntax - you may be able to use them to compile your GW-BASIC source with only minor modifications.
Rob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One more thing - if you send me your BASIC program and a sample file to process I could look into what parts of PC-BASIC it's using and see what makes this program so slow in particular. 22 minutes does seem like a long time, but my string manipulation code is old and, I suspect, very inefficient.
Cheers
Rob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks very much for your response. I will try some of your ideas. The program is simple enough I should be able to adapt it to any BASIC interpreter.
I'm attaching a zip file which contains the program and a cut down version of the input file. With this file it ran 3 minutes 22 seconds. (Under XP with GWBASIC it ran about a second. It was hard to time).
The program is ready to run. Its function is to go through the text file and select a program and write it out to an output file. The input file is comma delimited. If you see inefficiencies in the code please let me know.
By the way, I'm intrigued by the possibiity of running PCjr programs. I wrote a number of programs back in the 80's for the PCJr using cartridge BASIC and it would be nice to see them run again.
Again thanks for your help.
Also I don't have to be anonymous. I'm Tony Huddleston, [--email redacted]--].
Tony
Hi Tony, thanks for the program, I'll have a look at it!
I realised there is something else you can try that may help you - in DOSBox, you can increase the number of processor cycles with Ctrl+F12 - see http://www.dosbox.com/wiki/Performance . DOSBox is by default artificially being slowed down to 3000 cycles per second to make old games playable. It 's possible that you can speed up your program several times by increasing to, say, 20000 cycles per second or more.
PCjr programs written in Cartridge BASIC should run fine on PC-BASIC by the way, just use the preset=pcjr switch (see the documentation for details).
Rob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The DOSBox change resolved the performance problem after I ran it up to about 500000 processor cycles. The timing was reduced to about a second with the sample file I sent you. I still would like to use PC-BASIC and not have to rely on DOSBox if at all possible. I will definitely look into the PCjr option. Most of my PCjr programs were interactive and performance may not be a problem. My first problem is to locate those old programs. (lol)
Thanks for all your help.
Tony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I'm trying to get off GWBASIC on my XP computer. I'm running a job which reads a large text file sequentially.
Timings for same run: Native GWBASIC under XP --- 8.5 seconds.
Under PC-BASIC, 22 minutes, 32 seconds. What can I do to make it run faster? Is there a PC-BASIC compile option in the future? Even GWBASIC under DOSBox runs faster than PC-BASIC, though not much (18 minutes 54 seconds).
Thank you very much for any help. (By the way, I'm running PC-BASIC under Windows 10).
Tony
Hi Tony,
Unfortunately PC-BASIC is slow; mostly because it runs in Python, which is itself an interpreted language. It also does a lot of work to conform closely to GW-BASIC in things like the string and floating-point representation, which means it cannot use the much faster native libraries for such things. PC-BASIC in DOSBox is indeed faster.
I've been focussing most on making the emulator faithful to GW-BASIC; performance has so far been an afterthought. I do have some ideas on how to make it faster, but they are still in early stages. There are also still a large number of issues to solve that affect the emulator's faithfulness, which may need to take priority over performance.
You could try to run the development pre-release version with the
-n
command-line option. This does away with the graphical interface completely and works more like a command-line filter. It's best suited for scripting and file processing, which seems to be what you're doing.You can have both versions installed alongside each other. You may run into a few more bugs in the development version though - let me know if you do. Note that it may also well end up being slower - some of the code in that version still needs some work.
Building a compiler is a nice thought, but it would be a fairly large and almost completely separate project. I'm afraid I don't see it happening anytime soon...
Have you tried the free compilers FreeBASIC or QB64 ? They are compatible with QuickBASIC 4.5 and support line numbers and some of the GW-BASIC syntax - you may be able to use them to compile your GW-BASIC source with only minor modifications.
Rob
One more thing - if you send me your BASIC program and a sample file to process I could look into what parts of PC-BASIC it's using and see what makes this program so slow in particular. 22 minutes does seem like a long time, but my string manipulation code is old and, I suspect, very inefficient.
Cheers
Rob
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Thanks very much for your response. I will try some of your ideas. The program is simple enough I should be able to adapt it to any BASIC interpreter.
I'm attaching a zip file which contains the program and a cut down version of the input file. With this file it ran 3 minutes 22 seconds. (Under XP with GWBASIC it ran about a second. It was hard to time).
The program is ready to run. Its function is to go through the text file and select a program and write it out to an output file. The input file is comma delimited. If you see inefficiencies in the code please let me know.
By the way, I'm intrigued by the possibiity of running PCjr programs. I wrote a number of programs back in the 80's for the PCJr using cartridge BASIC and it would be nice to see them run again.
Again thanks for your help.
Also I don't have to be anonymous. I'm Tony Huddleston, [--email redacted]--].
Tony
Last edit: Rob Hagemans 2016-09-04
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Tony, thanks for the program, I'll have a look at it!
I realised there is something else you can try that may help you - in DOSBox, you can increase the number of processor cycles with Ctrl+F12 - see http://www.dosbox.com/wiki/Performance . DOSBox is by default artificially being slowed down to 3000 cycles per second to make old games playable. It 's possible that you can speed up your program several times by increasing to, say, 20000 cycles per second or more.
PCjr programs written in Cartridge BASIC should run fine on PC-BASIC by the way, just use the
preset=pcjr
switch (see the documentation for details).Rob
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
The DOSBox change resolved the performance problem after I ran it up to about 500000 processor cycles. The timing was reduced to about a second with the sample file I sent you. I still would like to use PC-BASIC and not have to rely on DOSBox if at all possible. I will definitely look into the PCjr option. Most of my PCjr programs were interactive and performance may not be a problem. My first problem is to locate those old programs. (lol)
Thanks for all your help.
Tony