arrays - GetUpperBound vs UBound for speed -
which faster? i've tried googling , couldn't find remotely helpful settle on own. best got simple dotnetfiddle: https://dotnetfiddle.net/i6yx6r
ubound
calls array.getupperbound
internally, implementation near identical:
public function ubound(byval array system.array, optional byval rank integer = 1) integer if (array nothing) throw vbmakeexception(new argumentnullexception(getresourcestring(resid.argument_invalidnullvalue1, "array")), vberrors.outofbounds) elseif (rank < 1) orelse (rank > array.rank) throw new rankexception(getresourcestring(resid.argument_invalidrank1, "rank")) end if return array.getupperbound(rank - 1) end function
this obtained microsoft's reference source.
the difference between 2 sure immeasurable, suspect ubound
ever slow since bounds checking, first.
in reality, because actual implementations same, use whichever more comfortable using stylistically.