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

Gareth Bult gareth at ...1689...
Sun Jan 18 00:33:19 CET 2009


Erm,

Both Python and Gambas compile to pseudo code and run through an interpreter .. so essentially they are the same in terms of the performance one might expect. Hence differences in performance will come down to the actual code you use and how good your relative examples are. In this case the Gambas example could be optimised a little (?)

My machine is a little quicker that yours ( ;-) ) and your example runs in ~ 2.9s.

However, modifying the split function to read;
  Return Scan(doc, "*WE*IO*")[1]

Reduces this to ~ 1.4s.

Could you supply your python code, then we could do a like for like comparison ??
(the different languages both have their strong and weak points re; speed)

Gareth.


----- Original Message -----
From: "birchy" <pokerbirch at ...1601...>
To: gambas-user at lists.sourceforge.net
Sent: Saturday, 17 January, 2009 10:31:49 PM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: [Gambas-user]  Gambas is slower than Python??


I'm quite confused. I'm from a VB6 background, so when i moved to Ubuntu as
my main O.S. Gambas was very attractive. Several things (mainly poor
documentation) pushed me to try other languages. Having done a little C,
C++, Java and PHP, i decided to give Python a go as it's getting very
popular. I ported a function that i have used for many years in VB6 into
Gambas and (today) have ported it to Python. Results are quite shocking to
be honest. The following code takes 4.2sec to run on my oldish AMD 3000 pc.
The Python version takes 1.9sec. Pythn is "only" a scripting language, so
what gives??

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

-- 
View this message in context: http://www.nabble.com/Gambas-is-slower-than-Python---tp21521606p21521606.html
Sent from the gambas-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
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

-- 
Managing Director, Encryptec Limited
Tel: 0845 5082719, Mob: 0785 3305393
Email: gareth at ...1689... 
Statements made are at all times subject to Encryptec's Terms and Conditions of Business, which are available upon request.




More information about the User mailing list