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

Jaap Cramer jaap_cramer at ...67...
Sun Jan 18 21:46:49 CET 2009


I timed the function with this line  s = Scan("QWERTYUIOP", "*WE*IO*")[1] to be 2.948007999919 seconds
But there is a faster way: 

s = Mid("QWERTYUIOP", InStr("QWERTYUIOP", "WE"), InStr("QWERTYUIOP", "IO"))
only takes 0.525806999998 sec!

Maybe the Scan function is not that optimized? :)

Jaap



> Date: Sun, 18 Jan 2009 10:33:17 -0800
> From: pokerbirch at ...1601...
> To: gambas-user at lists.sourceforge.net
> Subject: Re: [Gambas-user] Gambas is slower than Python??
> 
> 
> 
> Benoit Minisini wrote:
> > As I never used Python, I don't really realized how much an equivalent of 
> > partition() is needed.
> To be honest, partition() doesn't do anything that can't be achieved using
> Split() or Scan(), only reason i used partition() in Python is because it is
> quite a bit faster than Python's Split() function.
> 
> 
> Benoit Minisini wrote:
> > But if Scan() is slower than partition(), it does not mean necessarily
> > that 
> > Python is faster than Gambas globally. For example, just iterating a void 
> > loop 0..999999 takes 0,1s in Python, and 0,029s in Gambas 3.
> Naturally, i agree comparing a single function is not an accurate
> comparison. The reason i started this thread was because i was quite
> surprised that my Gambas function was so slow when i was expecting it to be
> significantly faster than Python.
> 
> 
> Benoit Minisini wrote:
> > If you want, I could make a partition() function temporarily just to
> > compare 
> > exactly the same thing between Gambas and Python. Do you?
> It's not important, however i DO think that a "GetSubstring" style string
> function would be useful if written in C:
> 
> 
> CODE wrote:
> > s = Substring(mainstring, startstring, endstring)   returns the substring
> > in between startstring and endstring within mainstring. Return is empty
> > string if not found.
> 
> Perhaps it's just me, but i would use this function all of the time for
> parsing strings. I know that it's easily achieved using Split() or Scan()
> but they are perhaps not as efficient??
> -- 
> View this message in context: http://www.nabble.com/Gambas-is-slower-than-Python---tp21521606p21531152.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

_________________________________________________________________
De leukste online filmpjes vind je op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl


More information about the User mailing list