-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
3,164 additions
and
718 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
language: scala | ||
sudo: false | ||
scala: | ||
- 2.10.4 | ||
- 2.11.4 | ||
matrix: | ||
include: | ||
- scala: 2.10.4 | ||
script: ./sbt ++$TRAVIS_SCALA_VERSION clean test | ||
|
||
- scala: 2.11.5 | ||
script: ./sbt ++$TRAVIS_SCALA_VERSION clean test | ||
after_success: "./sbt coveralls" |
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
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
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
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
42 changes: 42 additions & 0 deletions
42
algebird-caliper/src/test/scala/com/twitter/algebird/caliper/HLLPresentBenchmark.scala
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.twitter.algebird.caliper | ||
|
||
import com.google.caliper.{ SimpleBenchmark, Param } | ||
import com.twitter.algebird.{ HyperLogLogMonoid, HLL } | ||
import com.twitter.bijection._ | ||
import java.nio.ByteBuffer | ||
|
||
class HLLPresentBenchmark extends SimpleBenchmark { | ||
@Param(Array("5", "10", "17", "20")) | ||
val bits: Int = 0 | ||
|
||
@Param(Array("10", "100", "500", "1000", "10000")) | ||
val max: Int = 0 | ||
|
||
@Param(Array("10", "20", "100")) | ||
val numHLL: Int = 0 | ||
|
||
var data: IndexedSeq[HLL] = _ | ||
|
||
implicit val byteEncoder = implicitly[Injection[Long, Array[Byte]]] | ||
|
||
override def setUp { | ||
val hllMonoid = new HyperLogLogMonoid(bits) | ||
val r = new scala.util.Random(12345L) | ||
data = (0 until numHLL).map { _ => | ||
val input = (0 until max).map(_ => r.nextLong).toSet | ||
hllMonoid.batchCreate(input)(byteEncoder.toFunction) | ||
}.toIndexedSeq | ||
|
||
} | ||
|
||
def timeBatchCreate(reps: Int): Int = { | ||
var dummy = 0 | ||
while (dummy < reps) { | ||
data.foreach { hll => | ||
hll.approximateSize | ||
} | ||
dummy += 1 | ||
} | ||
dummy | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
algebird-caliper/src/test/scala/com/twitter/algebird/caliper/QTreeBenchmark.scala
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.twitter.algebird.caliper | ||
|
||
import com.twitter.algebird._ | ||
import scala.util.Random | ||
import com.twitter.bijection._ | ||
|
||
import java.util.concurrent.Executors | ||
import com.twitter.algebird.util._ | ||
import com.google.caliper.{ Param, SimpleBenchmark } | ||
import java.nio.ByteBuffer | ||
|
||
import scala.math._ | ||
|
||
class OldQTreeSemigroup[A: Monoid](k: Int) extends QTreeSemigroup[A](k) { | ||
override def sumOption(items: TraversableOnce[QTree[A]]) = | ||
if (items.isEmpty) None | ||
else Some(items.reduce(plus)) | ||
} | ||
|
||
class QTreeBenchmark extends SimpleBenchmark { | ||
var qtree: QTreeSemigroup[Long] = _ | ||
var oldqtree: QTreeSemigroup[Long] = _ | ||
|
||
@Param(Array("5", "10", "12")) | ||
val depthK: Int = 0 | ||
|
||
@Param(Array("100", "10000")) | ||
val numElements: Int = 0 | ||
|
||
var inputData: Seq[QTree[Long]] = _ | ||
|
||
override def setUp { | ||
qtree = new QTreeSemigroup[Long](depthK) | ||
oldqtree = new OldQTreeSemigroup(depthK) | ||
|
||
val rng = new Random("qtree".hashCode) | ||
|
||
inputData = (0L until numElements).map { _ => | ||
QTree(rng.nextInt(1000).toLong) | ||
} | ||
} | ||
|
||
def timeSumOption(reps: Int): Int = { | ||
var dummy = 0 | ||
while (dummy < reps) { | ||
qtree.sumOption(inputData) | ||
dummy += 1 | ||
} | ||
dummy | ||
} | ||
|
||
/* | ||
def timeOldSumOption(reps: Int): Int = { | ||
var dummy = 0 | ||
while (dummy < reps) { | ||
oldqtree.sumOption(inputData) | ||
dummy += 1 | ||
} | ||
dummy | ||
} */ | ||
} |
Oops, something went wrong.