[Gambas-user] Gambas is slower than Python??

nando nando_f at ...951...
Sun Jan 18 23:48:27 CET 2009


After reading all the comments about speed, optimization, etc,
do not forget that an optimizing compiler will absolutely
poduce faster execution time:
Since this code reads no data, saves no data and doesn't print any 
calculated data, then why even perform GetSubstring when nobody
cares about what the result is. An optimizing C compiler most likely
would compile to only execute the 
t= Timer  and
Print Timer - t
shich produces lightning fast times.
Why? Nobody will ever see the data computations performed inside the loop.
I recently did see optimized code disassembled for a small C program and
since nothing was printed nor saved, there was no code to run and the only
execution was RETURN.
Be careful testing code and making comparisons amongst languages because the
tests do not perform and prove unless the test is relatively meaningful
and results summed over a period of time testing.
Don't forget there are many ways to program solving a problem and
there are good and bad ways, easy and hard, fast and slow, efficient and not.
Spending a whole wack of time to prove saving 2 seconds may or may
not be futile and can or can not prove anything or nothing.
I use Gambas 1.17 for a large real-time 200 user mulit-connected program.
It performs well.
My appreciation to Benoit.
-Fernando

---------- Original Message -----------
From: Benoit Minisini <gambas at ...1...>
To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
Sent: Sun, 18 Jan 2009 01:42:28 +0100
Subject: Re: [Gambas-user] Gambas is slower than Python??

> > On samedi 17 janvier 2009, birchy wrote:
> > >
> > > PUBLIC SUB Main()
> > >   DIM i AS Integer, t AS Float, s AS String
> > >
> > >   t = Timer
> > >   FOR i = 0 TO 999999
> > >     s = GetSubstring("QWERTYUIOP", "WE", "IO")
> > >   NEXT
> > >   PRINT Timer - t
> > > END
> > >
> > > PRIVATE FUNCTION GetSubstring(doc AS String, startstring AS String,
> > > endstring AS String) AS String
> > >   RETURN Split(Split(doc, startstring)[2], endstring)[0]
> > > END
> 
> The previous code takes 4,31s on my PC with Gambas 2, and 3,01s with Gambas 3.
> 
> -- 
> Benoit Minisini
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list