Levenshtein Distance Algorithm: Fastest Implementation in C#
Here is a cleaned-up performance test for several different implementations of levenshtein I have blogged about recently. This test was emailed to me by Ahmed Ghoneim, who has also kindly agreed to its publication on my blog. I am very grateful to him for his excellent contribution. I have slightly altered his file to do away with the unnecessary local variables in my C2C# port of the GNULevenshtein method.
I would like to hear from you which methods perform best on your machine. Please drop a comment ^_^!
LevenshteinAlgorithmPerformanceTest.cs
code only
Packages
code, data and sample binary in zip and self-executable zip formats
Please note that the GNULevenshtein method was found to be buggy! Here is the new replacement method.
Comments
Thanks
Thanks
By the way I don't know anything about suffix trie dictionaries so I can't help you there. I would like to add you to my email contacts and visit your blog if you have one. Please drop a comment.
bye
http://www.koders.com/c/fidF5020AACF174C23AF41E57A8DF4080BF1FDC4849.aspx?s=levenshtein
I am going to update my blog ASAP after I have run several tests. Thank you very much for helping me correct my code.
I have implemented it in Java as an exercise (feel free to improve it). http://www.its.caltech.edu/~xuanluo/Levenshtein.java
It should be pretty easy to port it into C# or something like that. I would be interested in how it does if you test it.
Match: MULTIPLICATION Time: 509 Distance: 3 GNULevenshtein
Match: MULTIPLICATION Time: 479 Distance: 3 UnsafeVectorLevenshtein
Match: MULTIPLICATION Time: 657 Distance: 3 VectorLevenshtein
Match: MULTIPLICATION Time: 948 Distance: 3 MatrixLevenshtein
Match: MULTIPLICATION Time: 852 Distance: 3 JaggedLevenshtein
PC: Intel Core Quad 6600
OS: Windows Server 2008 x64
.NET: v3.5 SP1
Thank you for the perfect code!
Anton.
http://kyta.spb.ru
Match: MULTIPLICATION Time: 1033 Distance: 3 GNULevenshtein
Match: MULTIPLICATION Time: 1191 Distance: 3 UnsafeVectorLevenshtein
Match: MULTIPLICATION Time: 1239 Distance: 3 VectorLevenshtein
Match: MULTIPLICATION Time: 3554 Distance: 3 MatrixLevenshtein
Match: MULTIPLICATION Time: 2962 Distance: 3 JaggedLevenshtein
PC: Athlon x2 4850e
OS: Ubuntu 8.04 amd64
.NET: Mono 1.9
Thank you!
Anton.