Fast and efficient sorted arrays in JavaScript