in reply to Re^7: Fuzzy Searching: Optimizing Algorithm ( A few improvements).
in thread Fuzzy Searching: Optimizing Algorithm Selection

Im not sure if its a good idea to cache those strings, although it will of course speed things up I think it also may be problematic as it drammatically mushrooms the amount of memory your solution needs.

It's not the keys array I would move out, just the calculations and the $minZeros string, all of which would be constants if the keys are fixed length. I have done that locally and it is worth doing.

My latest variation is better still, but has a bug in the logic that means it finds a few duplicates (again). Still trying to crack that. Basically, it removes the inner ($offset2) loop, which has a dramatic affect on performance--if only I can get the accuracy back.


Examine what is said, not who speaks.        The end of an era!
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
  • Comment on Re^8: Fuzzy Searching: Optimizing Algorithm ( A few improvements).

Replies are listed 'Best First'.
Re^9: Fuzzy Searching: Optimizing Algorithm ( A few improvements).
by demerphq (Chancellor) on Dec 09, 2004 at 12:56 UTC

    It's not the keys array I would move out, just the calculations and the $minZeros string, all of which would be constants if the keys are fixed length. I have done that locally and it is worth doing.

    Yep. I did that (i think :-) once you pointed it out to me. :-)

    ---
    demerphq