higher performance implementation of ord