jeroendv / ComicUpdater

Comic Updater is a Firefox and Chrome extension that allows you to easily update your web comic bookmarks
0 stars 0 forks source link

profile fuzzymatch() #13

Open jeroendv opened 11 years ago

jeroendv commented 11 years ago

fuzzymatch() can take a while to match the current tab with all bookmarks, if one has a lot of bookmarks.

I have roughtly 600 bookmarks and it takes just over second to update my bookmark. This is a lot!! At least if feels like forever. Long enough to suspect something might be wrong

There are however ways to improve the fuzzymatch() algorithm. See http://rumkin.com/reference/algorithms/fuzzy_strings/ where a C implementation is available that does not use recursion. I believe wikipedia also mentions something alike.

See https://developers.google.com/chrome-developer-tools/docs/console-api#consolelogobject_object for more info on timing, profiling other usefull debugging and developping tools and information

jeroendv commented 11 years ago

Example timing of fuzzyMatch():

matching algorihthm: 5016.846ms
606 bookmarks were matched 

this means that in this instance fuzzyMatch(str1,str2) took 8 ms on avarage to compute.

timing of the matchTillEnd(): for the same tab

matching against bookmarks: 1.564ms
607 bookmarks were matched 

So yes ... fuzzyMatch() may be more powerfull, it is also much much slower :-s

jeroendv commented 11 years ago

another example for a much shorter url

matching against bookmarks: 1730.897ms
607 bookmarks were matched 

The length of the url thus seems to be a rather important factor, having a significant influence on the computation time.