Powerbasic Museum 2020-B

IT-Berater: Theo Gottwald (IT-Consultant) => Low Level Code Optimization => Low Level Code Optimization PB 9.0 => Topic started by: Theo Gottwald on August 12, 2008, 09:55:42 PM

Title: #OPTIMIZE: just recompile and its faster ...
Post by: Theo Gottwald on August 12, 2008, 09:55:42 PM
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.
Title: Re: #OPTIMIZE: just recompile and its faster ...
Post by: Petr Schreiber on August 12, 2008, 10:12:13 PM
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
Title: Re: #OPTIMIZE: just recompile and its faster ...
Post by: Petr Schreiber on August 12, 2008, 10:45:25 PM
Help file is online!

click click click (http://www.powerbasic.com/support/help/pbwin/)


Petr