joshaven / string_score

JavaScript string ranking 0 for no match upto 1 for perfect... "String".score("str"); //=> 0.825
MIT License
840 stars 62 forks source link

Optimizations reduce run time by about 55% #17

Closed aventuralabs closed 11 years ago

aventuralabs commented 11 years ago

Hey Josh - I've been using your string_score in a project and it's been tremendously helpful. My program makes enough comparisons that I needed to optimize things.

Apologies for changing the variable names. I am used to camelcase and needed it to think :)

On my machine, this optimization reduces a comparison from about 4.8 microseconds to 2.2 microseconds.

aventuralabs commented 11 years ago

Hadn't seen your tests at first, helped me to find two bugs, which have been fixed.

B