Archive for May 8th, 2017

Fastest method for Javascript substring search

I have a mobile application that needs to search through a rather large array and I’m experiencing some optimization issues with it. ¬†So, I decided to run some tests to see which function would be the fastest between indexOf, search, and includes.

I first tested all three with a static search value, search performed the best:


But, with a variable, indexOf performed the best:


I was able to perform these tests pretty easily using :)

Permalink » No comments