• Welcome to Powerbasic Museum 2020-B.
 

#OPTIMIZE: just recompile and its faster ...

Started by Theo Gottwald, August 12, 2008, 09:55:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

I got an interesting Info on another Goodie thats in the new PB 9, which has right now been announced ...

Quote#OPTIMIZE metastatement

Purpose
Choose between faster execution or smaller code size.

Syntax
#OPTIMIZE [SIZE | SPEED]

Remarks
The #OPTIMIZE metastatement is used to tell the compiler your preferences in regards to the optimization of generated code.  You can specify optimization for either execution speed or smaller code size.  If not used, the default is to choose faster code speed.

If you choose the SPEED option, one of the primary actions of the compiler is to align heavily used code sections on an address boundary which is most beneficial to the CPU/FPU.

In some cases, the speed of  mechanisms (FOR/NEXT, DO/UNTIL...) can be improved by as much as 100%, and occasionally even more.


See also
#ALIGN


In short: Just take your old code, recompile it and it will get immediately faster. Without any further changes.
Because the compiler now does an Aligning of Loops in Memory per default.

Petr Schreiber

That is neat,

I remember similar directive was in PB/DOS, good it is back!

It seems I am in BASIC programming for too long, when I read Bobs sentence:
Quote
GOTO www.powerbasic.com and <> PURCHASE

... I was thinking for a while whether "<>" means "does not equal", and what does it mean in context of sentence :)


Thanks,
Petr
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Petr Schreiber

AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com