Author Topic: #OPTIMIZE: just recompile and its faster ...  (Read 4165 times)

0 Members and 1 Guest are viewing this topic.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 918
    • it-berater
#OPTIMIZE: just recompile and its faster ...
« 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.

Offline Petr Schreiber

  • Full Member
  • ***
  • Posts: 183
Re: #OPTIMIZE: just recompile and its faster ...
« Reply #1 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
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Offline Petr Schreiber

  • Full Member
  • ***
  • Posts: 183
Re: #OPTIMIZE: just recompile and its faster ...
« Reply #2 on: August 12, 2008, 10:45:25 PM »
Help file is online!

click click click


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

psch.thinbasic.com