[Gambas-user] Gambas is slower than Python??
birchy
pokerbirch at ...1601...
Sun Jan 18 02:32:04 CET 2009
Benoit Minisini wrote:
> Can you show us the code in Python? Maybe it will help me to find
> something
> that could be enhanced in Gambas if Python can do better? :-)
Ok, i think the bottleneck is related to the function call overhead:
PYTHON: wrote:
>
> import time
>
> t = time.time()
> for i in range(999999):
> s = "QWERTYUIOP".partition("WE")[2].partition("IO")[0]
> print time.time() - t
>
GAMBAS: wrote:
>
> PUBLIC SUB Main()
> DIM i AS Integer, t AS Float, s AS String
>
> t = Timer
> FOR i = 0 TO 999999
> s = Scan("QWERTYUIOP", "*WE*IO*")[1]
> NEXT
> PRINT Timer - t
> END
>
Both of these run significantly faster when put in-line but Python is still
~33% faster. Perhaps you could add a new string function to achieve this as
it is VERY useful, yet rarely (if ever) seen in other languages?
--
View this message in context: http://www.nabble.com/Gambas-is-slower-than-Python---tp21521606p21523232.html
Sent from the gambas-user mailing list archive at Nabble.com.
More information about the User
mailing list