Posts: 3,522
Threads: 189
Joined: Dec 2003
Using x+x is faster then using x*2
Using x*x is faster then using x^2
x*x is faster then x^2
x*x*x is faster then using x^3
x*x*x*x is faster then using x^4
[...]
* is faster then ^ up until (roughly):
x^15
x*n is faster then x/n
Example:
x*0.2 is faster then x/5
IF [...] THEN is faster then SELECT CASE
CONST five=5
a=five
is faster then:
a=5
(especially large numbers)
Integers are the fastest numerical type.
[Doing more tests, will update later, if I have time and/or feel like it]
Posts: 1,688
Threads: 119
Joined: Jun 2003
redim array(23456)
is faster than
for t& = 0 to 23456
array(t&)
next
using '$static makes the program run faster than '$dynamic, but i don't use '$static much anymore...
adding defint a-z speeds up the program by a bunch
use:
poke x + y * 320&, color
rather than
pset (x,y), color
poke is faster, but only use this on screen 13h.
Jumping Jahoolipers!
Posts: 2,771
Threads: 96
Joined: Oct 2003
Barok, you forgot the DEFSEG &H800 or what ever the hexcode is for it...
Posts: 3,616
Threads: 287
Joined: Jan 2003
Code:
DEF SEG=&HA000
POKE X + Y * 320&, PixelColor
DEF SEG
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 451
Threads: 16
Joined: Feb 2003
Quote:redim array(23456)
is faster than
for t& = 0 to 23456
array(t&)
next
I don't even get what your trying to do with that loop.
Quote:using '$static makes the program run faster than '$dynamic, but i don't use '$static much anymore...
The problem with static programs is they can't have >64K arrays. This isn't always a problem and if you need large arrays, QB isn't the best method for handling them anyway.
Quote:adding defint a-z speeds up the program by a bunch
Really? Maybe if you don't explicitly declare variables and what type they are, but only bad coders do this. You're not a bad coder, are you? ;P
Quote:use:
poke x + y * 320&, color
rather than
pset (x,y), color
poke is faster, but only use this on screen 13h.
Who the hell uses that shit-ass mode?
Life is like a box of chocolates', hrm, WTF, no it isn't, more like, 'life is like a steaming pile of horse crap.'
Posts: 3,343
Threads: 83
Joined: Mar 2003
PQBers
. Faster than PSET, but slower than most libs.
Posts: 451
Threads: 16
Joined: Feb 2003
PQBers are retarded ass-monkeys who need to learn how to code.
Life is like a box of chocolates', hrm, WTF, no it isn't, more like, 'life is like a steaming pile of horse crap.'
Posts: 2,771
Threads: 96
Joined: Oct 2003
Well done, youve just insulted the likes of the great QBers such as Optimus, and the brilliant democoders.
Posts: 451
Threads: 16
Joined: Feb 2003
I wouldn't call anyone who is a PQB ass-monkey a 'great coder'. In fact, the PQB code I've seen from them has been anything but great. Most of it is slow, un-optimized and so hard to follow, they could at best qualify for 'ok coder', such as Optimus.
Life is like a box of chocolates', hrm, WTF, no it isn't, more like, 'life is like a steaming pile of horse crap.'
Posts: 3,522
Threads: 189
Joined: Dec 2003
I don't get what's with the "must have pure QB" thing.
QB is slow, if it can be made faster with a lib, then use it.
If YOU don't want to use a lib, then don't and shut up.
It's as simple as that. lol