Hey All,
I was recently toying with scalameter and it happened that the first thing I was trying to benchmark was sorting.
So I've implemented couple of sorting algorithms and then have written some simple benchmarks using scalameter.
Then I've realized that scalameter will always give me same arrays, and even worse they are always sorted. So the easy way was to shuffle arrays before sorting, but I thought that having some random array generators would be nice as well.
As a result I've got a very simple scalachek integration - an implicit conversion from scalacheck Gen to scalameter Gen. Then benchmarking with it has been quite simple.
The code sampe
import org.scalameter.Gen
import org.scalacheck.{Gen => SGen}
...
def random: Gen[(Int, SGen[Int])] = for {
size <- sizes
randomGen = SGen.choose(0, size)
} yield (size, randomGen)
def randomArrays: Gen[Array[Int]] = for {
(size, r) <- random
array <- SGen.containerOfN[Array, Int](size, r)
} yield array
I know that scalameter Gens are different from scalacheck Gens, but I see some usages of them together, like in my example.
So my question is do you think it could be useful for someone else? I can create a PR if that's the case
~
Thanks,
Eugene