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

birchy pokerbirch at ...1601...
Sat Jan 17 23:31:49 CET 2009


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.





More information about the User mailing list