[Gambas-devel] Optimization Options
Benoit Minisini
gambas at ...1...
Thu Apr 7 14:53:16 CEST 2005
On Thursday 07 April 2005 14:46, Alday Beloqui, Alberto wrote:
> 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
-O2 was crashing Gambas in previous versions of gcc... So I used -Os!
Maybe now, with gcc 3.X.X, things behave correctly, and I should replace -Os
by -O2.
Note that with -O2, the interpreter will become bigger than with -Os.
Regards,
--
Benoit Minisini
mailto:gambas at ...1...
More information about the Devel
mailing list