[Gambas-user] How to return results and status from a function to the calling procedure??

Benoit Minisini gambas at ...1...
Mon Dec 8 17:02:08 CET 2008


On lundi 8 décembre 2008, Doriano Blengino wrote:
> I am not so deep inside Gambas, but normally raise and catch
> (try/except) are really slow (I think, more than a byval parameter). If
> it is relatively rare that a true error happens in your code, then a
> raise/catch should be the right way to go.
>

Of course, some benchmarking is needed...

ByVal parameter are slower, because it adds a runtime test to check that the 
ByVal is allowed.

Exceptions are slower. But I don't know if they are really slow: raising an 
exception means using the longjmp() C function, creating the error object, 
freeing the stack until a CATCH or FINALLY is found in a function, or 
displaying an error if none is found. 

What you have to do by hand when you don't use exceptions.

But Creating the error object can be slow if you want the stack backtrace - 
This is the reason why there is an option for that in the Gambas 3 IDE.

Maybe sometimes exceptions could be faster by ByVal.

Regards,

-- 
Benoit Minisini




More information about the User mailing list