Qbasic slow execution speed

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
TropicalET
Newbie
Posts:8
Joined:Thu Jul 19, 2007 12:36 am
Location:Davis, CA
Qbasic slow execution speed

Post by TropicalET » Thu Sep 06, 2007 12:40 am

Friends:
I have my old QuickBasic program running nicely under DosBox-0.63, but it's excruciatingly slow. (I'm running Windows 2000). Here are my questions: Would it run faster if I recoded it in FreeBasic? Would it run faster if ran it on my laptop under Vista?
Appreciatively
-Seth

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Fri Sep 07, 2007 4:17 am

Why don't you run it directly in Windows? Mine runs fine in Windows XP.
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Sat Sep 08, 2007 2:39 am

There is also a program by Plasma, called EMS Magic. Check out http://phatcode.net for a download. I'm not sure if it will help or not, but it's worth a shot. He didn't write that program for nothing ya know! :p As for porting it to FreeBASIC, sure it will be a lot faster and compatible with more machines and platforms . That's automatic. ;) A lot of people have complained because FreeBASIC isn't exactly like QBasic though, so don't expect it to be or you'll be disappointed. :P
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

TropicalET
Newbie
Posts:8
Joined:Thu Jul 19, 2007 12:36 am
Location:Davis, CA

Qbasic slow execution speed

Post by TropicalET » Tue Sep 18, 2007 11:41 pm

Ralph, Dr D: thanks for your replies. I have resolved to nurse the old Q-basic code through one more publication (I'm using it for scientific computing, processing a 3 000 day record of weather data taken at hourly intervals). I can just get things set up and let it churn away over night -- should be easier than learning a new language no matter how similar to QB.

BTW, I don't find that QB 4.5 runs under windows 2000. DosBox was necessary to get it to go.

-TropicalET

TropicalET
Newbie
Posts:8
Joined:Thu Jul 19, 2007 12:36 am
Location:Davis, CA

Qbasic slow execution speed

Post by TropicalET » Fri Sep 28, 2007 12:40 am

I solved the problem! I had forgotten the trick Ralph advised me about: starting QB from a desktop icon, rather than going to Start/Run/c:\program files\DosBox-0.63\dosbox.exe
then z> mount c c:\
c
qbasic\qb

which obviously was a huge pain anyway. For some magical reason QB executes a zillion times faster when started from the desktop icon.

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Fri Sep 28, 2007 4:24 am

We're all glad that you solved the problem of QB running in Windows 2000. I tried the DOS Box long ago, when I thought my QB didn't run in Windows XP, Home Edition, and found it to be molasses in speed. With the help of some good QB guros, I traced the problem to a particular program that was running in the background, and, since then, QB runs just fine in XP, as you say, a zillion times faster!

By the way, there is nothing that I can imagine that would make QB run differently if started with a PROPER shortcut (icon). In fact, that's the way I always start it, with my own location of C:\BASIC\QB\qb.exe /L qb.qlb
It always starts great.

Notice that, by right-clicking on the icon, selecting Properties, selecting the Screen tab, then Full Screen, QB will open with a full screen, from there on. One can always go back and select the Window option as the start-up default.
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

Robertbarr
Newbie
Posts:9
Joined:Thu Mar 27, 2008 3:57 am

Post by Robertbarr » Thu Mar 27, 2008 4:10 am

Ralph wrote:

Notice that, by right-clicking on the icon, selecting Properties, selecting the Screen tab, then Full Screen, QB will open with a full screen, from there on. One can always go back and select the Window option as the start-up default.
Geez, I've been here about six minutes and I've already learned something I've wanted to know for years now. I've been putting up with that tiny screen inset ever since I started using QB with Windows.

I've used QB 3.0 since something like 1987 (can that be right?). I paid about a hundred bucks for it, and it came on two 5.25" floppies -- one for computers with math co-processors, and one for computers without. (Remember co-processors?)

The primary machine at the time was a 286 running at 8 MHz. Even at that -- and without that magic co-processor -- QB got the job done.

I've never really quit using it for long, since I'm so familiar with it, and also because it's the only language I'm familiar with that can run in double precision. I'm a land surveyor, and a lot of the academic challenges I've addressed require really competent calculations at very small angles, so QB is the 'weapon' of choice.

However, my use has been sporadic enough that I never really went online to research it. I figured QB had died and was long buried. So it's nice to find a QB forum alive and well!

R. Barr

Mac
Full Member
Posts:48
Joined:Wed Jun 29, 2005 2:01 am
Contact:

Post by Mac » Thu Mar 27, 2008 11:14 am

Ralph's our main guy here.

Mac

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Thu Mar 27, 2008 8:31 pm

Robert, don't believe Mac! He is the main guy here!

You say you have been using QB 3.0 since around 1987...I believe you, as I was able to upgrade my 4.0 version to 4.5 on October 30, 1988. And, let me tell you, upgrading to the 4.5 version will be super for you. It is the greatest, user-friendliest programming program around! You will simply love it! It is the same program, basically, as you've been using, except that evrything is at your fingertips. It catches all syntax errors as soon as you make them, it has a great and easy-to-access HELP file, and it runs immediately, as it compiles each line as soon as you ener it. Also, for a permanent, compiled file, you get it done with two or three clicks of the mouse! A real darling of a program, I must say. (The experts will tell us that it's the IDE - the Interactive Developement Enviorenment program - that does it, but, most users just call it QB 4.5).

Of course we remember the math co-processors. the 286 chip, and so on. And, after that, the co-processsors have never been required anymore, as all they did, and much more, has been incorporated in the micro-processor chips that followed.

You say "...also because it's the only language I'm familiar with that can run in double precision. I'm a land surveyor, and a lot of the academic challenges I've addressed require really competent calculations at very small angles, so QB is the 'weapon' of choice."
Well, I studied surveying, then civil , then mechanical, then electrical engineering, and got a degree in each. I ended becoming a PE in electrical engineering, and had a very happy carreer, until I retired at 73 in 1999. Now, I try to help others anyway I can, and QB is my preferred choice for programming, too!

Yes, there are some old users of QB that simply won't go away! And, we all have the same basic reason: we love the simplicity and almost English-like syntax for programming. Plus, we fell in love with version 4.5!

We hope you stay a while with us on this forum. We are certainly not the most knowledgeable, but, we try to be as helpful as we can.
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

Mike Chambers
Newbie
Posts:4
Joined:Wed Sep 27, 2006 3:45 am
Location:St. Louis, MO
Contact:

Post by Mike Chambers » Wed Jun 04, 2008 3:41 am

it does run fine in XP, but beware... quickbasic was written LONG before multitasking OSes were commonplace, so it is not very system-friendly in XP.

by that, i mean if you run it under XP, the ntdvm process WILL eat 100% CPU at all times. (ntvdm stands for NT Virtual DOS Machine, which is microsoft's fancy name for a 16-bit legacy app wrapper)

it's because since they didn't even think about multitasking when writing quickbasic. whatever instructions they decided to have the CPU run during idleness in QB are not friends with NTDVM.

really, there is no such thing as "idle CPU time"... even when it's idle, your processor is still running "NOP" instructions... stands for no operation. it also may be running instructions that poll the keyboard or mouse for input. depends what software is being run.

two solutions:

1. every time you load up QB, open XP's task manager, find the ntdvm.exe process, right click it and change priority to "idle" - that way you won't have annoying slowness and lockups in your other programs.

2. use DOSBox.

if you use DOSBox, it WILL be slow unless you go edit the dosbox.conf to increase emulated CPU cycles per second. i usually just change it to "auto" and it does fine.

i stick with the DOSBox (with NE2000 NIC emulation patch) method, because it allows me to work with the QB TCP routines i wrote.
DOS networking information

http://www.rubbermallet.org

Mike Chambers
Newbie
Posts:4
Joined:Wed Sep 27, 2006 3:45 am
Location:St. Louis, MO
Contact:

Post by Mike Chambers » Wed Jun 04, 2008 3:52 am

Ralph wrote:Robert, don't believe Mac! He is the main guy here!

You say you have been using QB 3.0 since around 1987...I believe you, as I was able to upgrade my 4.0 version to 4.5 on October 30, 1988. And, let me tell you, upgrading to the 4.5 version will be super for you. It is the greatest, user-friendliest programming program around! You will simply love it! It is the same program, basically, as you've been using, except that evrything is at your fingertips. It catches all syntax errors as soon as you make them, it has a great and easy-to-access HELP file, and it runs immediately, as it compiles each line as soon as you ener it. Also, for a permanent, compiled file, you get it done with two or three clicks of the mouse! A real darling of a program, I must say. (The experts will tell us that it's the IDE - the Interactive Developement Enviorenment program - that does it, but, most users just call it QB 4.5).

Of course we remember the math co-processors. the 286 chip, and so on. And, after that, the co-processsors have never been required anymore, as all they did, and much more, has been incorporated in the micro-processor chips that followed.

You say "...also because it's the only language I'm familiar with that can run in double precision. I'm a land surveyor, and a lot of the academic challenges I've addressed require really competent calculations at very small angles, so QB is the 'weapon' of choice."
Well, I studied surveying, then civil , then mechanical, then electrical engineering, and got a degree in each. I ended becoming a PE in electrical engineering, and had a very happy carreer, until I retired at 73 in 1999. Now, I try to help others anyway I can, and QB is my preferred choice for programming, too!

Yes, there are some old users of QB that simply won't go away! And, we all have the same basic reason: we love the simplicity and almost English-like syntax for programming. Plus, we fell in love with version 4.5!

We hope you stay a while with us on this forum. We are certainly not the most knowledgeable, but, we try to be as helpful as we can.
yes, QB 4.x and newer is fantastic! QB will never die, it always will have it's die-hard fans. it doesn't actually compile lines after you type them, it just checks them for proper syntax. no compiling is done until you run the program.

you probably won't even notice it on any even semi-modern machines, but when you tell it to "run" you can see in the bottom right corner of the screen "binding" and it goes through the line numbers. that's where it actually compiles.

i guarantee you'll notice it if you try to run QB on an XT-class system. :lol:

compiling to EXE on one of those takes a good 5+ minutes.
DOS networking information

http://www.rubbermallet.org

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Wed Jun 04, 2008 10:18 pm

Mike Chambers wrote:
yes, QB 4.x and newer is fantastic! QB will never die, it always will have it's die-hard fans. it doesn't actually compile lines after you type them, it just checks them for proper syntax. no compiling is done until you run the program.

you probably won't even notice it on any even semi-modern machines, but when you tell it to "run" you can see in the bottom right corner of the screen "binding" and it goes through the line numbers. that's where it actually compiles.

i guarantee you'll notice it if you try to run QB on an XT-class system.

compiling to EXE on one of those takes a good 5+ minutes.
1. Enter the followingprogram in QuickBASIC 4.5 and run it:
PRINT "Hi"
On my machine (see my signature for details), it runs in next to nothing! My conclusion, it is already compilec BEFORE i run it. I also seem to remember, from way back, that "The QuickBASIC IDE program compiles each line as soon as one enters it". (I'll do a Google Search later. to convirm.)

2. I don't know what an "XT machine" is, but, on my machine, I just now loaded my old 60-KB GG0.bas program, which I save in text form. OK, I loaded it, then pressed Shift+F5. I watched "the bottom right corner of the screen "binding" and it goes through the line numbers. that's where it actually compiles.". as Mike says, and couldn't see any thing at all...the program's first screen was up in a blink of an eye. This doesn't seem, to me, to be "actually compiling", and, if it is so, wow!, it compiles 60KB in less than 1 second, on my machine.

3. I saw "cpu usage 3%"; I ran qb.exe, and got, "cpu usage 53%". Soqb.exe took up 50% of the cpu. It still allowed me to use this post without any perceptible delays, as well as open my Yahoo. It is true that, when I run a graphics program in, say SCREEN 13, it takes about 4 to 5 seconds to run; but, that is still a far cry from 5 minutes!
Now, after selecting Make stand-alone file, from the moment I pressed the Make exe file, to the moment I say both he obj and then the exe filenames appear in the respective forler (directory), it was about 1 1/2 to 2 seconds, again, a far cry from the 5 minutes Mike reports.

It may just be that I;m lucky, but, I don't think so. Perhaps Mike can explain better what the problems he seems to experience are, with more description, so others may repeat his cases and report back on time it takes.

Finally, Mike, I do wantto let you know that I am trying to help here, and not criticize. It's just that what you report and my experiences don't seem to match!
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

Post Reply