08-13-2004, 06:19 PM
Quote:What would be next best after ASM? C++ right?FORTRAN.
Best Language For Number Crunching
|
08-13-2004, 06:19 PM
Quote:What would be next best after ASM? C++ right?FORTRAN.
08-13-2004, 06:20 PM
13,983,816 combinations in 1:50 to be exact. (I have an Athlon 2800.) The log file is 332 MB.
DEFINT A-Z makes the default data type integer, which is much faster than using singles (the default type otherwise). Since most of your numbers are integer, this helps a lot. The & on counter& forces the data type of counter to long integer to prevent an overflow.
08-13-2004, 06:24 PM
If you were using a 32-bit compiler, you could make it even faster, since LONG arithmetic in QB 4.5 really stinks - the compiler only generates 8086 code, so it can't use the 32-bit "e" registers for 32-bit integer math.
08-13-2004, 06:31 PM
Later versions of QB support 386 CPUs, don't it?
That definately where it drops off, though.
08-13-2004, 09:18 PM
VBDOS has a compiler switch /G3 to use 386 instructions, but that's it as far as I know. PDS has a /G2 switch to use 286 instructions.
08-13-2004, 11:02 PM
VBDOS /G3 switch only affect your code, the runtime libraries are 8086 code.
So the speed increase would be minimal. PDS has /G2, which makes it a tiny bit faster, nothing you'd notice, and again, the runtime libraries are still 8086 code... sucks... Code: Print "blah!" There might be an extremely small increase in the string handling stuff, but it's neglectable. Nevertheless, /G2 in PDS generates EXE's that (in some cases) are a few bytes smaller, so if size is an important thing, then /G2 can be used. Over at Pete's QB Site, in the zines (magazines) section, you can find some good info on commandline options, and compiler settings, for almost all versions of QB. If nothing else, it's a pretty good read, lot's of usefull information.
08-14-2004, 02:09 AM
The place where 386 instructions come in handy here is in the LONG arithmetic, not in the calls to standard library routines.
08-14-2004, 06:55 PM
Remember, a lot of speed is going to be removed if you are PRINTing every loop. Notice that Plasma moved the PRINT "blah number of combintations" to the outer FOR NEXT loop. This saves a hell of a lot of time.
Also, the printing to the file will slow the program down a lot. Try it without the recording to the file and you will notice another major speed increase. Finally, plasma added DEFINT A-Z. You say you dont know what this does, but as Plasma explained, it automatically makes all the datatypes as integers. These are much faster than floating point numbers, because of a bug in QB.
08-14-2004, 11:43 PM
Even with FFIX, integer math is faster than floating point.
08-15-2004, 04:13 AM
I wrote a similar program a while back, though not as fast because it has other features like matching the numbers with drawn numbers, and other stuff.
Take a look, you can change the coloums and rows for different wheels. Also uses a recursive sub, so it's kinda cool, check it out... Code: ''' Cya! |
« Next Oldest | Next Newest »
|