Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to FB
#1
I just downloaded FB and started to play around..
But i have some questions..

1. Using '$Static in qb was a real speed gainer, but then again you couldn't redim which kind of sucked. Now will me using '$Dynamic in fb slow my program down? Or is it a way to get around it by having one array dynamic and the rest static?

2. Then theres another thing. I just ported a small qb project and in the begining i used floating point math, but then i learnt how to convert it to fixed point math using a "point scale". Well now with freebasic, should i stick to this? Is it the same stadntards as with qb? Is fixed point math so much faster that floating point?

And one more thing that i just thought of. When using CONST what type will the declared variable be? For example CONST N = 3, Will N be a Integer, Short....

THX!
ttp://hem.passagen.se/qb.basta
Reply
#2
2: Because floating math slowdown was actually a slight bug in QB, it is fixed up properly in FB, resulting in a similar speed to integer math. I think (not sure) that is is still slightly faster, just due to the way it is computed.

It is probably good practice to keep using integer math, and only declare singles where required, this is standard in a lot of other languages.
Reply
#3
Always use static arrays if you can, less code is needed to access them then with the dynamic ones -- never use $dynamic, declare the arrays that REALLY must be dynamic using REDIM and let the other arrays as static.

Floating-point math is usually faster on new CPU's, fixed-point used to be great on old boxes.

Consts w/o prefixes are assumed to be integer's if the right-side expression didn't evaluate to a floating-point number, then they will be double's
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)