Closed hiddentao closed 10 years ago
I take that back regarding the Math.
method calls. They don't have as much impact as I thought.
I haven't done much optimization yet, but I think that the array allocations in fastTwoSum and extractScalar might be one source of slowness - https://github.com/ben-ng/add/blob/master/index.js#L41
If these functions are used a lot, it would be faster to statically allocate an array.
I wanted to know what the performance impact was so I added this in. I've added my results to the README.
The
Math.
functions are likely expensive compared to the rest of the code. I was able to massively speed upfast-levenshtein
by expandingMath.min()
into manual code. Perhaps the same can be done here. We'll never match native but I think we can get closer.