Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some optimization hints...
#1
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]
Reply
#2
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!
Reply
#3
Barok, you forgot the DEFSEG &H800 or what ever the hexcode is for it...
Reply
#4
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.
Reply
#5
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.'
Reply
#6
PQBers Wink. Faster than PSET, but slower than most libs.
Reply
#7
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.'
Reply
#8
Well done, youve just insulted the likes of the great QBers such as Optimus, and the brilliant democoders.
Reply
#9
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.'
Reply
#10
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)