summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2013-12-28 12:09:35 -0700
committerRocky Madden <git@rockymadden.com>2013-12-28 12:09:35 -0700
commit63edd09d2f77fbd99f71f2e2d54b68e56c17d024 (patch)
tree7622cfafd7517b221857346acc44d87d4c1cdccf
parent98baf7236fbd646495fdfaec01117439950fedce (diff)
downloadstringmetric-63edd09d2f77fbd99f71f2e2d54b68e56c17d024.tar.gz
stringmetric-63edd09d2f77fbd99f71f2e2d54b68e56c17d024.tar.bz2
stringmetric-63edd09d2f77fbd99f71f2e2d54b68e56c17d024.zip
Benchmark clean up to reflect changes to main.
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithmBenchmark.scala10
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithmBenchmark.scala10
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithmBenchmark.scala10
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmBenchmark.scala10
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithmBenchmark.scala10
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala14
-rwxr-xr-xcore/source/benchmark/scala/com/rockymadden/stringmetric/tokenize/NGramTokenizerBenchmark.scala10
21 files changed, 72 insertions, 198 deletions
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithmBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithmBenchmark.scala
index bfc17f2..fe5c80d 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithmBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithmBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class MetaphoneAlgorithmBenchmark extends CaliperBenchmark {
- import MetaphoneAlgorithmBenchmark.Algorithm
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -19,14 +17,10 @@ final class MetaphoneAlgorithmBenchmark extends CaliperBenchmark {
}
def timeComputeWithCharArray(reps: Int) = run(reps) {
- Algorithm.compute(charArray)
+ MetaphoneAlgorithm.compute(charArray)
}
def timeComputeWithString(reps: Int) = run(reps) {
- Algorithm.compute(string)
+ MetaphoneAlgorithm.compute(string)
}
}
-
-object MetaphoneAlgorithmBenchmark extends CaliperRunner(classOf[MetaphoneAlgorithmBenchmark]) {
- private final val Algorithm = MetaphoneAlgorithm()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricBenchmark.scala
index 147ab54..c9b59fc 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricBenchmark.scala
@@ -6,8 +6,6 @@ import scala.annotation.tailrec
import scala.util.Random
final class MetaphoneMetricBenchmark extends CaliperBenchmark {
- import MetaphoneMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -34,22 +32,18 @@ final class MetaphoneMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ MetaphoneMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ MetaphoneMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ MetaphoneMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ MetaphoneMetric.compare(string1, string1)
}
}
-
-object MetaphoneMetricBenchmark extends CaliperRunner(classOf[MetaphoneMetricBenchmark]) {
- private final val Metric = MetaphoneMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithmBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithmBenchmark.scala
index 79f9e16..ac04cd7 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithmBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithmBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class NysiisAlgorithmBenchmark extends CaliperBenchmark {
- import NysiisAlgorithmBenchmark.Algorithm
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -19,14 +17,10 @@ final class NysiisAlgorithmBenchmark extends CaliperBenchmark {
}
def timeComputeWithCharArray(reps: Int) = run(reps) {
- Algorithm.compute(charArray)
+ NysiisAlgorithm.compute(charArray)
}
def timeComputeWithString(reps: Int) = run(reps) {
- Algorithm.compute(string)
+ NysiisAlgorithm.compute(string)
}
}
-
-object NysiisAlgorithmBenchmark extends CaliperRunner(classOf[NysiisAlgorithmBenchmark]) {
- private final val Algorithm = NysiisAlgorithm()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricBenchmark.scala
index 620d054..f975d29 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricBenchmark.scala
@@ -6,8 +6,6 @@ import scala.annotation.tailrec
import scala.util.Random
final class NysiisMetricBenchmark extends CaliperBenchmark {
- import NysiisMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -34,22 +32,18 @@ final class NysiisMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ NysiisMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ NysiisMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ NysiisMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ NysiisMetric.compare(string1, string1)
}
}
-
-object NysiisMetricBenchmark extends CaliperRunner(classOf[NysiisMetricBenchmark]) {
- private final val Metric = NysiisMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithmBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithmBenchmark.scala
index 885bc3a..4141b37 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithmBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithmBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class RefinedNysiisAlgorithmBenchmark extends CaliperBenchmark {
- import RefinedNysiisAlgorithmBenchmark.Algorithm
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -19,14 +17,10 @@ final class RefinedNysiisAlgorithmBenchmark extends CaliperBenchmark {
}
def timeComputeWithCharArray(reps: Int) = run(reps) {
- Algorithm.compute(charArray)
+ RefinedNysiisAlgorithm.compute(charArray)
}
def timeComputeWithString(reps: Int) = run(reps) {
- Algorithm.compute(string)
+ RefinedNysiisAlgorithm.compute(string)
}
}
-
-object RefinedNysiisAlgorithmBenchmark extends CaliperRunner(classOf[RefinedNysiisAlgorithmBenchmark]) {
- private final val Algorithm = RefinedNysiisAlgorithm()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricBenchmark.scala
index d0da4e5..d927f18 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricBenchmark.scala
@@ -6,8 +6,6 @@ import scala.annotation.tailrec
import scala.util.Random
final class RefinedNysiisMetricBenchmark extends CaliperBenchmark {
- import RefinedNysiisMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -34,22 +32,18 @@ final class RefinedNysiisMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ RefinedNysiisMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ RefinedNysiisMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ RefinedNysiisMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ RefinedNysiisMetric.compare(string1, string1)
}
}
-
-object RefinedNysiisMetricBenchmark extends CaliperRunner(classOf[RefinedNysiisMetricBenchmark]) {
- private final val Metric = RefinedNysiisMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmBenchmark.scala
index 99aa3df..ec8d53c 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class RefinedSoundexAlgorithmBenchmark extends CaliperBenchmark {
- import RefinedSoundexAlgorithmBenchmark.Algorithm
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -19,14 +17,10 @@ final class RefinedSoundexAlgorithmBenchmark extends CaliperBenchmark {
}
def timeComputeWithCharArray(reps: Int) = run(reps) {
- Algorithm.compute(charArray)
+ RefinedSoundexAlgorithm.compute(charArray)
}
def timeComputeWithString(reps: Int) = run(reps) {
- Algorithm.compute(string)
+ RefinedSoundexAlgorithm.compute(string)
}
}
-
-object RefinedSoundexAlgorithmBenchmark extends CaliperRunner(classOf[RefinedSoundexAlgorithmBenchmark]) {
- private final val Algorithm = RefinedSoundexAlgorithm()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricBenchmark.scala
index 8e24650..6c52e8d 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricBenchmark.scala
@@ -6,8 +6,6 @@ import scala.annotation.tailrec
import scala.util.Random
final class RefinedSoundexMetricBenchmark extends CaliperBenchmark {
- import RefinedSoundexMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -34,22 +32,18 @@ final class RefinedSoundexMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ RefinedSoundexMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ RefinedSoundexMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ RefinedSoundexMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ RefinedSoundexMetric.compare(string1, string1)
}
}
-
-object RefinedSoundexMetricBenchmark extends CaliperRunner(classOf[RefinedSoundexMetricBenchmark]) {
- private final val Metric = RefinedSoundexMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithmBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithmBenchmark.scala
index 5c195a6..9dc67de 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithmBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithmBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class SoundexAlgorithmBenchmark extends CaliperBenchmark {
- import SoundexAlgorithmBenchmark.Algorithm
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -19,14 +17,10 @@ final class SoundexAlgorithmBenchmark extends CaliperBenchmark {
}
def timeComputeWithCharArray(reps: Int) = run(reps) {
- Algorithm.compute(charArray)
+ SoundexAlgorithm.compute(charArray)
}
def timeComputeWithString(reps: Int) = run(reps) {
- Algorithm.compute(string)
+ SoundexAlgorithm.compute(string)
}
}
-
-object SoundexAlgorithmBenchmark extends CaliperRunner(classOf[SoundexAlgorithmBenchmark]) {
- private final val Algorithm = SoundexAlgorithm()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricBenchmark.scala
index 6534d72..7707019 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricBenchmark.scala
@@ -6,8 +6,6 @@ import scala.annotation.tailrec
import scala.util.Random
final class SoundexMetricBenchmark extends CaliperBenchmark {
- import SoundexMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -34,22 +32,18 @@ final class SoundexMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ SoundexMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ SoundexMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ SoundexMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ SoundexMetric.compare(string1, string1)
}
}
-
-object SoundexMetricBenchmark extends CaliperRunner(classOf[SoundexMetricBenchmark]) {
- private final val Metric = SoundexMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala
index cfcda28..5df27fb 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class DiceSorensenMetricBenchmark extends CaliperBenchmark {
- import DiceSorensenMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class DiceSorensenMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)(2)
+ DiceSorensenMetric(2).compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)(2)
+ DiceSorensenMetric(2).compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)(2)
+ DiceSorensenMetric(2).compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)(2)
+ DiceSorensenMetric(2).compare(string1, string1)
}
}
-
-object DiceSorensenMetricBenchmark extends CaliperRunner(classOf[DiceSorensenMetricBenchmark]) {
- private final val Metric = DiceSorensenMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala
index d75b8aa..3d04074 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class HammingMetricBenchmark extends CaliperBenchmark {
- import HammingMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class HammingMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ HammingMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ HammingMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ HammingMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ HammingMetric.compare(string1, string1)
}
}
-
-object HammingMetricBenchmark extends CaliperRunner(classOf[HammingMetricBenchmark]) {
- private final val Metric = HammingMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala
index 8ea7066..ddeef7a 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class JaccardMetricBenchmark extends CaliperBenchmark {
- import JaccardMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class JaccardMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)(2)
+ JaccardMetric(2).compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)(2)
+ JaccardMetric(2).compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)(2)
+ JaccardMetric(2).compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)(2)
+ JaccardMetric(2).compare(string1, string1)
}
}
-
-object JaccardMetricBenchmark extends CaliperRunner(classOf[JaccardMetricBenchmark]) {
- private final val Metric = JaccardMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala
index 998b7d7..47baa6d 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class JaroMetricBenchmark extends CaliperBenchmark {
- import JaroMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class JaroMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ JaroMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ JaroMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ JaroMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ JaroMetric.compare(string1, string1)
}
}
-
-object JaroMetricBenchmark extends CaliperRunner(classOf[JaroMetricBenchmark]) {
- private final val Metric = JaroMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala
index 3c1f650..c11a01c 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class JaroWinklerMetricBenchmark extends CaliperBenchmark {
- import JaroWinklerMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class JaroWinklerMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ JaroWinklerMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ JaroWinklerMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ JaroWinklerMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ JaroWinklerMetric.compare(string1, string1)
}
}
-
-object JaroWinklerMetricBenchmark extends CaliperRunner(classOf[JaroWinklerMetricBenchmark]) {
- private final val Metric = JaroWinklerMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala
index 31eda09..a8460e2 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class LevenshteinMetricBenchmark extends CaliperBenchmark {
- import LevenshteinMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class LevenshteinMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ LevenshteinMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ LevenshteinMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ LevenshteinMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ LevenshteinMetric.compare(string1, string1)
}
}
-
-object LevenshteinMetricBenchmark extends CaliperRunner(classOf[LevenshteinMetricBenchmark]) {
- private final val Metric = LevenshteinMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala
index b8cff9c..8ba1bb0 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class NGramMetricBenchmark extends CaliperBenchmark {
- import NGramMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -36,22 +34,18 @@ final class NGramMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)(n)
+ NGramMetric(n).compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)(n)
+ NGramMetric(n).compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)(n)
+ NGramMetric(n).compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)(n)
+ NGramMetric(n).compare(string1, string1)
}
}
-
-object NGramMetricBenchmark extends CaliperRunner(classOf[NGramMetricBenchmark]) {
- private final val Metric = NGramMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala
index e31ea97..89207f2 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class OverlapMetricBenchmark extends CaliperBenchmark {
- import OverlapMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class OverlapMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)(2)
+ OverlapMetric(2).compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)(2)
+ OverlapMetric(2).compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)(2)
+ OverlapMetric(2).compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)(2)
+ OverlapMetric(2).compare(string1, string1)
}
}
-
-object OverlapMetricBenchmark extends CaliperRunner(classOf[OverlapMetricBenchmark]) {
- private final val Metric = OverlapMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala
index 39d221c..86196ab 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class RatcliffObershelpMetricBenchmark extends CaliperBenchmark {
- import RatcliffObershelpMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class RatcliffObershelpMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)
+ RatcliffObershelpMetric.compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)
+ RatcliffObershelpMetric.compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)
+ RatcliffObershelpMetric.compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)
+ RatcliffObershelpMetric.compare(string1, string1)
}
}
-
-object RatcliffObershelpMetricBenchmark extends CaliperRunner(classOf[RatcliffObershelpMetricBenchmark]) {
- private final val Metric = RatcliffObershelpMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala
index bde24a1..837ce01 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class WeightedLevenshteinMetricBenchmark extends CaliperBenchmark {
- import WeightedLevenshteinMetricBenchmark.Metric
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -33,22 +31,18 @@ final class WeightedLevenshteinMetricBenchmark extends CaliperBenchmark {
}
def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray2)(1, 1, 1)
+ WeightedLevenshteinMetric(1, 1, 1).compare(charArray1, charArray2)
}
def timeCompareWithDifferentStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string2)(1, 1, 1)
+ WeightedLevenshteinMetric(1, 1, 1).compare(string1, string2)
}
def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) {
- Metric.compare(charArray1, charArray1)(1, 1, 1)
+ WeightedLevenshteinMetric(1, 1, 1).compare(charArray1, charArray1)
}
def timeCompareWithIdenticalStrings(reps: Int) = run(reps) {
- Metric.compare(string1, string1)(1, 1, 1)
+ WeightedLevenshteinMetric(1, 1, 1).compare(string1, string1)
}
}
-
-object WeightedLevenshteinMetricBenchmark extends CaliperRunner(classOf[WeightedLevenshteinMetricBenchmark]) {
- private final val Metric = WeightedLevenshteinMetric()
-}
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/tokenize/NGramTokenizerBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/tokenize/NGramTokenizerBenchmark.scala
index dbc48d4..d66bf88 100755
--- a/core/source/benchmark/scala/com/rockymadden/stringmetric/tokenize/NGramTokenizerBenchmark.scala
+++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/tokenize/NGramTokenizerBenchmark.scala
@@ -5,8 +5,6 @@ import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner}
import scala.util.Random
final class NGramTokenizerBenchmark extends CaliperBenchmark {
- import NGramTokenizerBenchmark.Tokenizer
-
@Param(Array("0", "1", "2", "4", "8", "16"))
var length: Int = _
@@ -22,14 +20,10 @@ final class NGramTokenizerBenchmark extends CaliperBenchmark {
}
def timeComputeWithCharArray(reps: Int) = run(reps) {
- Tokenizer.tokenize(charArray)(n)
+ NGramTokenizer(n).tokenize(charArray)
}
def timeComputeWithString(reps: Int) = run(reps) {
- Tokenizer.tokenize(string)(n)
+ NGramTokenizer(n).tokenize(string)
}
}
-
-object NGramTokenizerBenchmark extends CaliperRunner(classOf[NGramTokenizerBenchmark]) {
- private final val Tokenizer = NGramTokenizer()
-}