Skip to content

Commit

Permalink
fix warnings (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
satorg authored Dec 14, 2022
1 parent fa4aafc commit 8f35faf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class BitSetBenchmarks {
var size: Int = _
var indices: Array[Int] = _

var values: Array[Int] = _
var values: Vector[Int] = _
var sci: immutable.BitSet = _
var scm: mutable.BitSet = _
var iset: immutable.Set[Int] = _
var ccbs: _root_.cats.collections.BitSet = _

var values2: Array[Int] = _
var values2: Vector[Int] = _
var sci2: immutable.BitSet = _
var scm2: mutable.BitSet = _
var iset2: immutable.Set[Int] = _
Expand All @@ -63,17 +63,17 @@ class BitSetBenchmarks {
val r = new Random(0x13572468)

values = (0 until size).iterator.filter { _ =>
r.nextDouble < density
}.toArray
r.nextDouble() < density
}.toVector

sci = immutable.BitSet(values: _*)
scm = mutable.BitSet(values: _*)
iset = immutable.Set(values: _*)
ccbs = _root_.cats.collections.BitSet(values: _*)

values2 = (0 until size).iterator.filter { _ =>
r.nextDouble < density
}.toArray
r.nextDouble() < density
}.toVector

sci2 = immutable.BitSet(values2: _*)
scm2 = mutable.BitSet(values2: _*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ class DietAddBench extends BestCaseRangesList {

@Benchmark
def scalazDievAdd(): Unit = {
scalazValues.foldLeft(Diev.empty[Int])((d, r) => d + r)
scalazValues.foldLeft(Diev.empty[Int])((d, r) => d + r): Unit
}

@Benchmark
def dogsDietAddRange(): Unit = {
dogRanges.foldLeft(Diet.empty[Int])((d, r) => d + Range(r.start, r.end))
dogRanges.foldLeft(Diet.empty[Int])((d, r) => d + Range(r.start, r.end)): Unit
}

@Benchmark
def scalazDievAddRange(): Unit = {
scalazRanges.foldLeft(Diev.empty[Int])((d, r) => d + ((r.start, r.end)))
scalazRanges.foldLeft(Diev.empty[Int])((d, r) => d + ((r.start, r.end))): Unit
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,25 @@ import scala.util.Random
@State(Scope.Benchmark)
class DietRandomizeBench extends BigNumberLists {

// import dogs.Predef._

implicit val scalazEnumInt: Monoid[Int] with Enum[Int] with Show[Int] = scalaz.std.anyVal.intInstance

@Benchmark
def dogsDietAddRandom(): Unit = {
Random.shuffle(scala).foldLeft(Diet.empty[Int])((d, r) => d + r)
Random.shuffle(scala).foldLeft(Diet.empty[Int])((d, r) => d + r): Unit
}

@Benchmark
def scalazDievAddRandom(): Unit = {
Random.shuffle(scalazlst.toList).foldLeft(Diev.empty[Int])((d, r) => d + r)
Random.shuffle(scalazlst.toList).foldLeft(Diev.empty[Int])((d, r) => d + r): Unit
}

@Benchmark
def dogsDietAddRangeRandom(): Unit = {
Random.shuffle(scala).foldLeft(Diet.empty[Int])((d, r) => d + Range(r, r + 10))
Random.shuffle(scala).foldLeft(Diet.empty[Int])((d, r) => d + Range(r, r + 10)): Unit
}

@Benchmark
def scalazDievAddRangeRandom(): Unit = {
var diev = Diev.empty[Int]

Random.shuffle(scalazlst.toList).foldLeft(Diev.empty[Int])((d, r) => d + ((r, r + 10)))
Random.shuffle(scalazlst.toList).foldLeft(Diev.empty[Int])((d, r) => d + ((r, r + 10))): Unit
}
}

0 comments on commit 8f35faf

Please sign in to comment.