[Gambas-devel] Optimization Options

Alday Beloqui, Alberto aalday at ...288...
Thu Apr 7 14:46:16 CEST 2005


I'm not sure if this is the right way to make this type of comments.......

I'm testing optimizations on bytecode interpreter, forcing inline of SUBR_xx
functions, but while testing i realiced that gcc  optimization options on
MAKEFILE are strange.

Why -Os and -O2 ?

I changed Makefile on main/gbx just deleting -Os from CFLAGS ans CXXFLAGS

I run my little test program after recompiling /main/gbx and found more than
10% performance gain.




Test program

' Gambas module file

PUBLIC SUB Main()

DIM ret AS Integer
DIM i AS Integer
DIM t1 AS Float
DIM t2 AS Float

PRINT Now
t1 = Timer()
FOR i = 1 TO 500000
  ret = ffactarr()
NEXT
t2 = Timer()

PRINT CStr(ret)
PRINT CStr(t2 - t1)

END
PRIVATE FUNCTION fact(n AS Integer) AS Integer
IF n < 3 THEN RETURN n
RETURN n * fact(n - 1)
END

PRIVATE FUNCTION ffactarr() AS Integer
  DIM res AS Integer
  DIM i AS Integer
  FOR i = 0 TO 9
    res = res + fact(i)
  NEXT
  RETURN res

END
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20050407/9b70c3bc/attachment.html>


More information about the Devel mailing list