Reduce virtual calls for get_arity

Saves compiled code size and some minor runtime differences