You might find this bit of performance engineering interesting: https://github.com/timschmidt/hyperreal/blob/8a016808f4b0ba3...
The matrix math layer wanted that kind of optimization to avoid worst case operations.