[Gambas-user] Wow, Gambas is twice as fast as (Free) Pascal

Benoît Minisini gambas at ...1...
Sat Oct 11 02:50:40 CEST 2014


Le 11/10/2014 02:31, T Lee Davidson a écrit :
> I've been looking at Lazarus lately due to its cross-platform compile
> ability. So...
>
> Just for fun I took the Polynom benchmark program from
> gambaswiki.org/wiki/doc/benchmark and converted it to Free Pascal; then
> compiled it with the Free Pascal Compiler ('fpc').
>
> Much to my surprise, the *pre-compiled* Pascal program ran twice as slow
> as the Gambas program that was compiled on-the-fly:
>
> `time gbs3 -f -c polynom.gambas`
> 1250000
> 1250000
> 1250000
> 1250000
> 1250000
> 1250000
> 1250000
> 1250000
> 1250000
> 1250000
>
> real    0m17.904s
> user    0m9.603s
> sys     0m0.052s
>
>
> Pre-compiled FP executable:
> `time ./polynom`
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>    1.25000000000000E+006
>
> real    0m35.247s
> user    0m20.936s
> sys     0m0.032s
>
>
> Maybe it's just me, but I think that's impressive. Go Gambas!
>
> (Now if only we could target Mono ...)
>
> :-)
> Lee
>

If the Pascal program does not print the same thing as the Gambas 
program, then the Pascal program is wrong. Apparently, it uses floating 
point numbers instead of integers, which could explain why it is slower.

Regards,

-- 
Benoît Minisini




More information about the User mailing list