July 2009
1 post
Better array search
Update: Added more data to show differences.
During the journey of finding a better linear array search function in javascript, I decided to write my own. I decided to take a different approach. Here’s the outcome.
Array.prototype.small_search = function(search) {
if (this[0] === search){ return 0; }
var s = '\x00';
var a = this.join(s);
var b = a.search(search)-1;
...