-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating readme with newer competitive benchmark results, updating Be…
…nchmarks, bumping version number, ReleaseNotes, including docs in nuget package. Remove old Fastenshtein versions from competitive benchmark Updating Benchmarks Altering message Project file upgrades, fixing License link, including docs, version bump
- Loading branch information
1 parent
0d930bd
commit 9e564d2
Showing
12 changed files
with
433 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,46 @@ | ||
namespace Fastenshtein.Benchmarking | ||
{ | ||
public class BenchmarkSmallWordsSingleThread : FastenshteinBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(90, 5); | ||
} | ||
|
||
public class BenchmarkNormalWordsSingleThread : FastenshteinBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(60, 20); | ||
} | ||
|
||
public class BenchmarkLargeWordsSingleThread : FastenshteinBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(10, 400); | ||
} | ||
|
||
public class CompetitiveBenchmarkSmallWordsSingleThread : CompetitiveSingleThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(90, 5); | ||
} | ||
|
||
public class CompetitiveBenchmarkNormalWordsSingleThread : CompetitiveSingleThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(60, 20); | ||
} | ||
|
||
public class CompetitiveBenchmarkLargeWordsSingleThread : CompetitiveSingleThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(20, 400); | ||
} | ||
|
||
public class CompetitiveBenchmarkSmallWordsMultiThread : CompetitiveMultiThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(100, 5); | ||
} | ||
|
||
public class CompetitiveBenchmarkNormalWordsMultiThread : CompetitiveMultiThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(90, 20); | ||
} | ||
|
||
public class CompetitiveBenchmarkLargeWordsMultiThread : CompetitiveMultiThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(50, 400); | ||
} | ||
namespace Fastenshtein.Benchmarking; | ||
|
||
public class BenchmarkSmallWordsSingleThread : FastenshteinBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(90, 5); | ||
} | ||
|
||
public class BenchmarkNormalWordsSingleThread : FastenshteinBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(60, 20); | ||
} | ||
|
||
public class BenchmarkLargeWordsSingleThread : FastenshteinBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(10, 400); | ||
} | ||
|
||
public class CompetitiveBenchmarkSmallWordsSingleThread : CompetitiveSingleThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(90, 5); | ||
} | ||
|
||
public class CompetitiveBenchmarkNormalWordsSingleThread : CompetitiveSingleThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(60, 20); | ||
} | ||
|
||
public class CompetitiveBenchmarkLargeWordsSingleThread : CompetitiveSingleThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(20, 400); | ||
} | ||
|
||
public class CompetitiveBenchmarkSmallWordsMultiThread : CompetitiveMultiThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(100, 5); | ||
} | ||
|
||
public class CompetitiveBenchmarkNormalWordsMultiThread : CompetitiveMultiThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(90, 20); | ||
} | ||
|
||
public class CompetitiveBenchmarkLargeWordsMultiThread : CompetitiveMultiThreadBenchmark | ||
{ | ||
protected override string[] CreateTestData() => RandomWords.Create(50, 400); | ||
} |
185 changes: 81 additions & 104 deletions
185
benchmarks/Fastenshtein.Benchmarking/CompetitiveMultiThreadBenchmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1,105 @@ | ||
namespace Fastenshtein.Benchmarking | ||
{ | ||
using BenchmarkDotNet.Attributes; | ||
using System.Threading.Tasks; | ||
namespace Fastenshtein.Benchmarking; | ||
|
||
[RankColumn] | ||
public abstract class CompetitiveMultiThreadBenchmark | ||
{ | ||
protected string[] words; | ||
using BenchmarkDotNet.Attributes; | ||
using System.Threading.Tasks; | ||
|
||
protected abstract string[] CreateTestData(); | ||
[RankColumn] | ||
public abstract class CompetitiveMultiThreadBenchmark | ||
{ | ||
private string[] _words; | ||
|
||
[GlobalSetup] | ||
public void SetUp() | ||
{ | ||
this.words = this.CreateTestData(); | ||
} | ||
protected abstract string[] CreateTestData(); | ||
|
||
/* | ||
* To add your own Levenshtein to the benchmarking alter the below code. | ||
* Replace YourLevenshtein with your method. | ||
*/ | ||
////[Benchmark] | ||
////public void YourLevenshtein() | ||
////{ | ||
//// Parallel.For(0, words.Length, i => | ||
//// { | ||
//// for (int j = 0; j < words.Length; j++) | ||
//// { | ||
//// YourLevenshtein(words[i], words[j]); | ||
//// } | ||
//// }); | ||
////} | ||
[GlobalSetup] | ||
public void SetUp() | ||
=> _words = CreateTestData(); | ||
|
||
[Benchmark] | ||
public void Fastenshtein() | ||
{ | ||
Parallel.For(0, words.Length, i => | ||
{ | ||
var levenshtein = new global::Fastenshtein.Levenshtein(words[i]); | ||
/* | ||
* To add your own Levenshtein to the benchmarking alter the below code. | ||
* Replace YourLevenshtein with your method. | ||
*/ | ||
////[Benchmark] | ||
////public void YourLevenshtein() | ||
////{ | ||
//// var words = _words; | ||
//// Parallel.For(0, words.Length, i => | ||
//// { | ||
//// for (int j = 0; j < words.Length; j++) | ||
//// { | ||
//// YourLevenshtein(words[i], words[j]); | ||
//// } | ||
//// }); | ||
////} | ||
|
||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
levenshtein.DistanceFrom(words[j]); | ||
} | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void FastenshteinStatic() | ||
[Benchmark(Baseline = true)] | ||
public void Fastenshtein() | ||
{ | ||
var words = _words; | ||
Parallel.For(0, words.Length, i => | ||
{ | ||
Parallel.For(0, words.Length, i => | ||
{ | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
global::Fastenshtein.Levenshtein.Distance(words[i], words[j]); | ||
} | ||
}); | ||
} | ||
var levenshtein = new global::Fastenshtein.Levenshtein(words[i]); | ||
[Benchmark(Baseline = true)] | ||
public void Fastenshtein_1_0_0_8() | ||
{ | ||
Parallel.For(0, words.Length, i => | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
var levenshtein = new global::Fastenshtein.Benchmarking.FastenshteinOld.Fastenshtein_1_0_0_8(words[i]); | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
levenshtein.DistanceFrom(words[j]); | ||
} | ||
}); | ||
} | ||
levenshtein.DistanceFrom(words[j]); | ||
} | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void FastenshteinStatic_1_0_0_8() | ||
[Benchmark] | ||
public void FastenshteinStatic() | ||
{ | ||
var words = _words; | ||
Parallel.For(0, words.Length, i => | ||
{ | ||
Parallel.For(0, words.Length, i => | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
global::Fastenshtein.Benchmarking.FastenshteinOld.Fastenshtein_1_0_0_8.Distance(words[i], words[j]); | ||
} | ||
}); | ||
} | ||
global::Fastenshtein.Levenshtein.Distance(words[i], words[j]); | ||
} | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void StringSimilarity() | ||
{ | ||
// I've read the source code it is thread safe | ||
var lev = new global::F23.StringSimilarity.Levenshtein(); | ||
[Benchmark] | ||
public void StringSimilarity() | ||
{ | ||
// I've read the source code it is thread safe | ||
var lev = new global::F23.StringSimilarity.Levenshtein(); | ||
|
||
Parallel.For(0, words.Length, i => | ||
var words = _words; | ||
Parallel.For(0, words.Length, i => | ||
{ | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
// why does it return a double ?? | ||
lev.Distance(words[i], words[j]); | ||
} | ||
}); | ||
} | ||
// why does it return a double ?? | ||
lev.Distance(words[i], words[j]); | ||
} | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public void NinjaNye() | ||
[Benchmark] | ||
public void NinjaNye() | ||
{ | ||
var words = _words; | ||
Parallel.For(0, words.Length, i => | ||
{ | ||
Parallel.For(0, words.Length, i => | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
global::NinjaNye.SearchExtensions.Levenshtein.LevenshteinProcessor.LevenshteinDistance(words[i], words[j]); | ||
} | ||
}); | ||
} | ||
global::NinjaNye.SearchExtensions.Levenshtein.LevenshteinProcessor.LevenshteinDistance(words[i], words[j]); | ||
} | ||
}); | ||
} | ||
|
||
|
||
[Benchmark] | ||
public void FuzzyStringsNetStandard() | ||
[Benchmark] | ||
public void FuzzyStringsNetStandard() | ||
{ | ||
var words = _words; | ||
Parallel.For(0, words.Length, i => | ||
{ | ||
Parallel.For(0, words.Length, i => | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
for (int j = 0; j < words.Length; j++) | ||
{ | ||
global::DuoVia.FuzzyStrings.LevenshteinDistanceExtensions.LevenshteinDistance(words[i], words[j], true); | ||
} | ||
}); | ||
} | ||
global::DuoVia.FuzzyStrings.LevenshteinDistanceExtensions.LevenshteinDistance(words[i], words[j], true); | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.