JSPerf mutations algorithms

JSPerf mutations algorithms
0.0 0


I completed this algorithm before looking in this forum to see how others solved the challenge.

If you are curious whether RegExp or indexOf approach was faster you can see the results
jsperf on mutations algorithms


I wasn’t happy with my regex algorithm attempt to resolve the mutations challenge as it performed 99% slower than the top algorithm.

I gave it more more attempt, this time no use of RegExp and no use of indexOf,

Just plain old for-loops and using string method. charAt. My 2nd attempt performed 3% slower to the top algorithm. I can live with that. Lesson learned is that RexExp might be good for some things, but not all things when it comes down to single character matching in any order.