Does exception handling slow down app?

Which is faster?

Function Get(ts as string) as string
return t_dict.Value(ts)

exception KeyNotFoundException
  return "default"
end sub

or:

Function Get(ts as string) as string
if t_dict.Haskey(ts) then
   return t_dict.Value(ts)
else
   return "default"
end if
end sub

Sometimes I pass a key that is not contained in the dictionary and I return a default value.


Thanks,
Tomas

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to