Optimize vcomp() function by pre-calculating string length and whether or not values should be compared numerically.