diff options
author | Rocky Madden <git@rockymadden.com> | 2013-02-11 21:17:07 -0700 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2013-02-11 21:17:07 -0700 |
commit | eb36c1bc243d8d7e3969b3808bbaaf8b233fb40a (patch) | |
tree | 4a870ee3a4287fe9951e6538a617d707689457d9 /core/source/benchmark/scala/com/rockymadden | |
parent | 2892761e2a8812ec2381dfa74c6c3a8e4f3fb998 (diff) | |
download | stringmetric-eb36c1bc243d8d7e3969b3808bbaaf8b233fb40a.tar.gz stringmetric-eb36c1bc243d8d7e3969b3808bbaaf8b233fb40a.tar.bz2 stringmetric-eb36c1bc243d8d7e3969b3808bbaaf8b233fb40a.zip |
Fixed benchmarks, per the new trait structure.
Diffstat (limited to 'core/source/benchmark/scala/com/rockymadden')
19 files changed, 159 insertions, 83 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 f1e7c5a..c8c22e8 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithmBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithmBenchmark.scala @@ -5,6 +5,8 @@ import com.rockymadden.stringmetric.{ CaliperBenchmark, CaliperRunner } import scala.util.Random final class MetaphoneAlgorithmBenchmark extends CaliperBenchmark { + import MetaphoneAlgorithmBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -17,12 +19,14 @@ final class MetaphoneAlgorithmBenchmark extends CaliperBenchmark { } def timeComputeWithCharArray(reps: Int) = run(reps) { - MetaphoneAlgorithm.compute(charArray) + Algorithm.compute(charArray) } def timeComputeWithString(reps: Int) = run(reps) { - MetaphoneAlgorithm.compute(string) + Algorithm.compute(string) } } -object MetaphoneAlgorithmBenchmark extends CaliperRunner(classOf[MetaphoneAlgorithmBenchmark])
\ No newline at end of file +object MetaphoneAlgorithmBenchmark extends CaliperRunner(classOf[MetaphoneAlgorithmBenchmark]) { + private final val Algorithm = new 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 538a82f..73a9b4f 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class MetaphoneMetricBenchmark extends CaliperBenchmark { + import MetaphoneMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class MetaphoneMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - MetaphoneMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - MetaphoneMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - MetaphoneMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - MetaphoneMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object MetaphoneMetricBenchmark extends CaliperRunner(classOf[MetaphoneMetricBenchmark])
\ No newline at end of file +object MetaphoneMetricBenchmark extends CaliperRunner(classOf[MetaphoneMetricBenchmark]) { + private final val Metric = new 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 65dafe5..9680c77 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithmBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithmBenchmark.scala @@ -5,6 +5,8 @@ import com.rockymadden.stringmetric.{ CaliperBenchmark, CaliperRunner } import scala.util.Random final class NysiisAlgorithmBenchmark extends CaliperBenchmark { + import NysiisAlgorithmBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -17,12 +19,14 @@ final class NysiisAlgorithmBenchmark extends CaliperBenchmark { } def timeComputeWithCharArray(reps: Int) = run(reps) { - NysiisAlgorithm.compute(charArray) + Algorithm.compute(charArray) } def timeComputeWithString(reps: Int) = run(reps) { - NysiisAlgorithm.compute(string) + Algorithm.compute(string) } } -object NysiisAlgorithmBenchmark extends CaliperRunner(classOf[NysiisAlgorithmBenchmark])
\ No newline at end of file +object NysiisAlgorithmBenchmark extends CaliperRunner(classOf[NysiisAlgorithmBenchmark]) { + private final val Algorithm = new 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 9c2dfd4..5be6ef8 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class NysiisMetricBenchmark extends CaliperBenchmark { + import NysiisMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class NysiisMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - NysiisMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - NysiisMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - NysiisMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - NysiisMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object NysiisMetricBenchmark extends CaliperRunner(classOf[NysiisMetricBenchmark])
\ No newline at end of file +object NysiisMetricBenchmark extends CaliperRunner(classOf[NysiisMetricBenchmark]) { + private final val Metric = new 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 2304e3e..95fd775 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithmBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithmBenchmark.scala @@ -5,6 +5,8 @@ import com.rockymadden.stringmetric.{ CaliperBenchmark, CaliperRunner } import scala.util.Random final class RefinedNysiisAlgorithmBenchmark extends CaliperBenchmark { + import RefinedNysiisAlgorithmBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -17,12 +19,14 @@ final class RefinedNysiisAlgorithmBenchmark extends CaliperBenchmark { } def timeComputeWithCharArray(reps: Int) = run(reps) { - RefinedNysiisAlgorithm.compute(charArray) + Algorithm.compute(charArray) } def timeComputeWithString(reps: Int) = run(reps) { - RefinedNysiisAlgorithm.compute(string) + Algorithm.compute(string) } } -object RefinedNysiisAlgorithmBenchmark extends CaliperRunner(classOf[RefinedNysiisAlgorithmBenchmark])
\ No newline at end of file +object RefinedNysiisAlgorithmBenchmark extends CaliperRunner(classOf[RefinedNysiisAlgorithmBenchmark]) { + private final val Algorithm = new 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 08c9178..8a9e208 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class RefinedNysiisMetricBenchmark extends CaliperBenchmark { + import RefinedNysiisMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class RefinedNysiisMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - RefinedNysiisMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - RefinedNysiisMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - RefinedNysiisMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - RefinedNysiisMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object RefinedNysiisMetricBenchmark extends CaliperRunner(classOf[RefinedNysiisMetricBenchmark])
\ No newline at end of file +object RefinedNysiisMetricBenchmark extends CaliperRunner(classOf[RefinedNysiisMetricBenchmark]) { + private final val Metric = new 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 7d4a016..cbb5d10 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmBenchmark.scala @@ -5,6 +5,8 @@ import com.rockymadden.stringmetric.{ CaliperBenchmark, CaliperRunner } import scala.util.Random final class RefinedSoundexAlgorithmBenchmark extends CaliperBenchmark { + import RefinedSoundexAlgorithmBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -17,12 +19,14 @@ final class RefinedSoundexAlgorithmBenchmark extends CaliperBenchmark { } def timeComputeWithCharArray(reps: Int) = run(reps) { - RefinedSoundexAlgorithm.compute(charArray) + Algorithm.compute(charArray) } def timeComputeWithString(reps: Int) = run(reps) { - RefinedSoundexAlgorithm.compute(string) + Algorithm.compute(string) } } -object RefinedSoundexAlgorithmBenchmark extends CaliperRunner(classOf[RefinedSoundexAlgorithmBenchmark])
\ No newline at end of file +object RefinedSoundexAlgorithmBenchmark extends CaliperRunner(classOf[RefinedSoundexAlgorithmBenchmark]) { + private final val Algorithm = new 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 c95804f..9ccaf95 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class RefinedSoundexMetricBenchmark extends CaliperBenchmark { + import RefinedSoundexMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class RefinedSoundexMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - RefinedSoundexMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - RefinedSoundexMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - RefinedSoundexMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - RefinedSoundexMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object RefinedSoundexMetricBenchmark extends CaliperRunner(classOf[RefinedSoundexMetricBenchmark])
\ No newline at end of file +object RefinedSoundexMetricBenchmark extends CaliperRunner(classOf[RefinedSoundexMetricBenchmark]) { + private final val Metric = new 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 eac0941..91dad8f 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithmBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithmBenchmark.scala @@ -5,6 +5,8 @@ import com.rockymadden.stringmetric.{ CaliperBenchmark, CaliperRunner } import scala.util.Random final class SoundexAlgorithmBenchmark extends CaliperBenchmark { + import SoundexAlgorithmBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -17,12 +19,14 @@ final class SoundexAlgorithmBenchmark extends CaliperBenchmark { } def timeComputeWithCharArray(reps: Int) = run(reps) { - SoundexAlgorithm.compute(charArray) + Algorithm.compute(charArray) } def timeComputeWithString(reps: Int) = run(reps) { - SoundexAlgorithm.compute(string) + Algorithm.compute(string) } } -object SoundexAlgorithmBenchmark extends CaliperRunner(classOf[SoundexAlgorithmBenchmark])
\ No newline at end of file +object SoundexAlgorithmBenchmark extends CaliperRunner(classOf[SoundexAlgorithmBenchmark]) { + private final val Algorithm = new 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 190111e..df2828f 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class SoundexMetricBenchmark extends CaliperBenchmark { + import SoundexMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class SoundexMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - SoundexMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - SoundexMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - SoundexMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - SoundexMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object SoundexMetricBenchmark extends CaliperRunner(classOf[SoundexMetricBenchmark])
\ No newline at end of file +object SoundexMetricBenchmark extends CaliperRunner(classOf[SoundexMetricBenchmark]) { + private final val Metric = new 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 08559e4..8f4a90e 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class DiceSorensenMetricBenchmark extends CaliperBenchmark { + import DiceSorensenMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class DiceSorensenMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - DiceSorensenMetric.compare(charArray1, charArray2)(2) + Metric.compare(charArray1, charArray2)(2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - DiceSorensenMetric.compare(string1, string2)(2) + Metric.compare(string1, string2)(2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - DiceSorensenMetric.compare(charArray1, charArray1)(2) + Metric.compare(charArray1, charArray1)(2) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - DiceSorensenMetric.compare(string1, string1)(2) + Metric.compare(string1, string1)(2) } } -object DiceSorensenMetricBenchmark extends CaliperRunner(classOf[DiceSorensenMetricBenchmark])
\ No newline at end of file +object DiceSorensenMetricBenchmark extends CaliperRunner(classOf[DiceSorensenMetricBenchmark]) { + private final val Metric = new 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 095aeef..660ac88 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class HammingMetricBenchmark extends CaliperBenchmark { + import HammingMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class HammingMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - HammingMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - HammingMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - HammingMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - HammingMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object HammingMetricBenchmark extends CaliperRunner(classOf[HammingMetricBenchmark])
\ No newline at end of file +object HammingMetricBenchmark extends CaliperRunner(classOf[HammingMetricBenchmark]) { + private final val Metric = new HammingMetric +} 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 0bb690a..b2da3dc 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class JaroMetricBenchmark extends CaliperBenchmark { + import JaroMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class JaroMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - JaroMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - JaroMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - JaroMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - JaroMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object JaroMetricBenchmark extends CaliperRunner(classOf[JaroMetricBenchmark])
\ No newline at end of file +object JaroMetricBenchmark extends CaliperRunner(classOf[JaroMetricBenchmark]) { + private final val Metric = new 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 1e27733..e85597a 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class JaroWinklerMetricBenchmark extends CaliperBenchmark { + import JaroWinklerMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class JaroWinklerMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - JaroWinklerMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - JaroWinklerMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - JaroWinklerMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - JaroWinklerMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object JaroWinklerMetricBenchmark extends CaliperRunner(classOf[JaroWinklerMetricBenchmark])
\ No newline at end of file +object JaroWinklerMetricBenchmark extends CaliperRunner(classOf[JaroWinklerMetricBenchmark]) { + private final val Metric = new 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 75cb46b..01c6a6c 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class LevenshteinMetricBenchmark extends CaliperBenchmark { + import LevenshteinMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class LevenshteinMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - LevenshteinMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - LevenshteinMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - LevenshteinMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - LevenshteinMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object LevenshteinMetricBenchmark extends CaliperRunner(classOf[LevenshteinMetricBenchmark])
\ No newline at end of file +object LevenshteinMetricBenchmark extends CaliperRunner(classOf[LevenshteinMetricBenchmark]) { + private final val Metric = new LevenshteinMetric +} diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithmBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithmBenchmark.scala index eabdf55..0b8f718 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithmBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithmBenchmark.scala @@ -5,6 +5,8 @@ import com.rockymadden.stringmetric.{ CaliperBenchmark, CaliperRunner } import scala.util.Random final class NGramAlgorithmBenchmark extends CaliperBenchmark { + import NGramAlgorithmBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -20,12 +22,14 @@ final class NGramAlgorithmBenchmark extends CaliperBenchmark { } def timeComputeWithCharArray(reps: Int) = run(reps) { - NGramAlgorithm.compute(charArray)(n) + Algorithm.compute(charArray)(n) } def timeComputeWithString(reps: Int) = run(reps) { - NGramAlgorithm.compute(string)(n) + Algorithm.compute(string)(n) } } -object NGramAlgorithmBenchmark extends CaliperRunner(classOf[NGramAlgorithmBenchmark])
\ No newline at end of file +object NGramAlgorithmBenchmark extends CaliperRunner(classOf[NGramAlgorithmBenchmark]) { + private final val Algorithm = new NGramAlgorithm +} 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 74ce1ea..4829b22 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class NGramMetricBenchmark extends CaliperBenchmark { + import NGramMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -35,20 +37,22 @@ final class NGramMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - NGramMetric.compare(charArray1, charArray2)(n) + Metric.compare(charArray1, charArray2)(n) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - NGramMetric.compare(string1, string2)(n) + Metric.compare(string1, string2)(n) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - NGramMetric.compare(charArray1, charArray1)(n) + Metric.compare(charArray1, charArray1)(n) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - NGramMetric.compare(string1, string1)(n) + Metric.compare(string1, string1)(n) } } -object NGramMetricBenchmark extends CaliperRunner(classOf[NGramMetricBenchmark])
\ No newline at end of file +object NGramMetricBenchmark extends CaliperRunner(classOf[NGramMetricBenchmark]) { + private final val Metric = new NGramMetric +} 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 d4217cf..6050cc7 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class RatcliffObershelpMetricBenchmark extends CaliperBenchmark { + import RatcliffObershelpMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class RatcliffObershelpMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - RatcliffObershelpMetric.compare(charArray1, charArray2) + Metric.compare(charArray1, charArray2) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - RatcliffObershelpMetric.compare(string1, string2) + Metric.compare(string1, string2) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - RatcliffObershelpMetric.compare(charArray1, charArray1) + Metric.compare(charArray1, charArray1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - RatcliffObershelpMetric.compare(string1, string1) + Metric.compare(string1, string1) } } -object RatcliffObershelpMetricBenchmark extends CaliperRunner(classOf[RatcliffObershelpMetricBenchmark]) +object RatcliffObershelpMetricBenchmark extends CaliperRunner(classOf[RatcliffObershelpMetricBenchmark]) { + private final val Metric = new 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 a096809..a5424a2 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala @@ -6,6 +6,8 @@ import scala.annotation.tailrec import scala.util.Random final class WeightedLevenshteinMetricBenchmark extends CaliperBenchmark { + import WeightedLevenshteinMetricBenchmark._ + @Param(Array("0", "1", "2", "4", "8", "16")) var length: Int = _ @@ -32,20 +34,22 @@ final class WeightedLevenshteinMetricBenchmark extends CaliperBenchmark { } def timeCompareWithDifferentCharArrays(reps: Int) = run(reps) { - WeightedLevenshteinMetric.compare(charArray1, charArray2)(1, 1, 1) + Metric.compare(charArray1, charArray2)(1, 1, 1) } def timeCompareWithDifferentStrings(reps: Int) = run(reps) { - WeightedLevenshteinMetric.compare(string1, string2)(1, 1, 1) + Metric.compare(string1, string2)(1, 1, 1) } def timeCompareWithIdenticalCharArrays(reps: Int) = run(reps) { - WeightedLevenshteinMetric.compare(charArray1, charArray1)(1, 1, 1) + Metric.compare(charArray1, charArray1)(1, 1, 1) } def timeCompareWithIdenticalStrings(reps: Int) = run(reps) { - WeightedLevenshteinMetric.compare(string1, string1)(1, 1, 1) + Metric.compare(string1, string1)(1, 1, 1) } } -object WeightedLevenshteinMetricBenchmark extends CaliperRunner(classOf[WeightedLevenshteinMetricBenchmark])
\ No newline at end of file +object WeightedLevenshteinMetricBenchmark extends CaliperRunner(classOf[WeightedLevenshteinMetricBenchmark]) { + private final val Metric = new WeightedLevenshteinMetric +} |