alkis commented on PR #40121:
URL: https://github.com/apache/spark/pull/40121#issuecomment-1441455987
I ran this benchmark offline:
```
test("benchmark") {
val input: Seq[Int] = 0 until 1000
val numRuns = 1000
def kernel(): Long = {
val shuffled = Random.shuffle(input).toArray
val start = System.nanoTime()
val h = new PercentileHeap(0.95)
shuffled.foreach { x =>
h.insert(x)
for (_ <- 0 until input.length) h.percentile
}
System.nanoTime() - start
}
for (_ <- 0 until numRuns) kernel() // warmup
var elapsed: Long = 0
for (_ <- 0 until numRuns) elapsed += kernel()
val perOp = elapsed / (numRuns * input.length)
println(s"$perOp ns per op on heaps of size ${input.length}")
// 3886 ns per op on heaps of size 1000
// 1703 ns per op on heaps of size 1000
}
```
Results:
```
BEFORE 3886 ns per op on heaps of size 1000
AFTER 1703 ns per op on heaps of size 1000
```
I left this test in the PR instead of a full blown benchmark.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]