MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Efficiency of try..endtry



Colin McCormick wrote:
> 
> Can anyone give me an idea of which of these code segments will be more 
> efficient to try to call a verb that I do not know exists?
> 
> [A] ... (try/endtry)
> [B] ... (if v in verbs())

As I understand it it's also important to consider how often the test will
fail.  Exception handling seems to be relatively cheap *unless* you actually
raise errors, at which point it becomes extremely expensive.

Of course you could also rename your #2:notfound() verb to #2:*, and then
calls to nonexistant verbs will automatically be handled by that.  ;-)

--Ben


References:

Home | Subject Index | Thread Index