I have a program in which I need to calculate several times the Levenshtein distance between pairs of words (one of them fixed), and several times may range from about 1000 to 120000 for every fixed word. Since I want to optimize this program as much as I can I thought about implementing these calculations in assembly. The problem is that I know nothing about assembly except for the theory and that it may represent big speed improvements. Can anyone please help me or provide me with the assembly code for this distance? Also, how can I call assembly from a C# module?
Share
You could easily use a BK-tree to create a lookup tree if Levenshtein is enough. Damarau-Levenshtein can not be used with a metric tree.
You dont need to write this implementation in assembler or C#, you can get far by using unsafe code and pointers.
str.Length, those are method invocations (most probably inlined/optimized)fixed(char* ptrX=strX, ptrY=strY) ...int[] state = new int[rows*cols]fixed(int* ptrState=state)L('catz', 'cats') == L('z', 's') == 1L('rats', 'cats') == L('r', 'c') == 1