Have you tried to run the test on a performance benchmark platform such as jsperf?
Reduce should take the sum as input and use accumulator + current not accumulator += current me thinks.
I just put your test into jsperf…
Interesting. Although I believe your results to be wrong. I just had a look at the codepen and it seems that you don’t apply the multiplication inside the while() block. You just push the index item into the output array. I also recommend you run the test in a proper performance testing suite such as JSperf. I copied your blocks and added the…
A quick note on 18.04 not being available through the upgrade manager to date. Canonical prefers to make the upgrade for the 16.04 LTS available once the point release 18.04.1 (which includes several LTS stability fixes) is available. This way, the system running the older LTS version remains stable after upgrading to the newer LTS version.
Hi Peter, I really like what you are doing here. I have been working on my algorithm based on the Mapbox Distance Matrix and only just got around to do a proper write up for medium. Would be great to get some feedback from someone who understands the matter.
Thanks John. Excellent recommendation here. I was never a fan of the big || concat construct but wasn’t aware of the FORMAT method. So much cleaner. I just tested and updated my gist. This is the main reason why I post this on Medium. To get more input from people who want to improve the algorithm.