Skip to content

Commit

Permalink
Fixes to benchmark support
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Dec 27, 2024
1 parent 58ae85b commit 3c8887e
Show file tree
Hide file tree
Showing 24 changed files with 261 additions and 424 deletions.
Binary file not shown.
Binary file removed benchmark/charts/Get Each Record-total-time.png
Binary file not shown.
Binary file removed benchmark/charts/Insert Records-total-time.png
Binary file not shown.
Binary file not shown.
Binary file removed benchmark/charts/Search All Records-total-time.png
Binary file not shown.
Binary file not shown.
Binary file removed benchmark/charts/Search Each Record-total-time.png
Binary file not shown.
Binary file removed benchmark/charts/Stream Records Multi-total-time.png
Binary file not shown.
Binary file removed benchmark/charts/Stream Records-total-time.png
Binary file not shown.
274 changes: 0 additions & 274 deletions benchmark/report-LightDB-SQLite-Previous.json

This file was deleted.

8 changes: 4 additions & 4 deletions benchmark/src/main/scala/benchmark/FlushingBacklog.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package benchmark

import cats.effect.IO
import rapid._

import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.{AtomicBoolean, AtomicInteger}
Expand Down Expand Up @@ -36,7 +37,7 @@ abstract class FlushingBacklog[Key, Value](val batchSize: Int, val maxSize: Int)
}

private def waitForBuffer(): Task[Unit] = if (size.get() > maxSize) {
IO.sleep(1.second).flatMap(_ => waitForBuffer())
Task.sleep(1.second).flatMap(_ => waitForBuffer())
} else {
Task.unit
}
Expand All @@ -50,8 +51,8 @@ abstract class FlushingBacklog[Key, Value](val batchSize: Int, val maxSize: Int)
}
}

private def pollingStream: rapid.Stream[Value] = fs2.Stream
.fromBlockingIterator[IO](map.keys().asIterator().asScala, 512)
private def pollingStream: rapid.Stream[Value] = rapid.Stream
.fromIterator(Task(map.keys().asIterator().asScala))
.map { key =>
val o = Option(map.remove(key))
if (o.nonEmpty) {
Expand All @@ -66,7 +67,6 @@ abstract class FlushingBacklog[Key, Value](val batchSize: Int, val maxSize: Int)
.unNone

private def prepareWrite(): Task[Unit] = pollingStream
.compile
.toList
.flatMap { list =>
writeBatched(list)
Expand Down
5 changes: 2 additions & 3 deletions benchmark/src/main/scala/benchmark/IOIterator.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package benchmark

import cats.effect.IO
import cats.implicits._
import rapid.Task

import java.util.concurrent.atomic.AtomicInteger
import scala.concurrent.{ExecutionContext, Future}

trait IOIterator[T] {
val running = new AtomicInteger(0)
Expand All @@ -16,7 +15,7 @@ trait IOIterator[T] {
running.incrementAndGet()
recursiveStream(f)
}
ios.sequence.map(_ => ())
ios.tasks.map(_ => ())
}

private def recursiveStream(f: T => Task[Unit]): Task[Unit] = next().flatMap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fabric.io.{JsonFormatter, JsonParser}
import fabric.rw._
import io.quickchart.QuickChart
import org.apache.commons.io.FileUtils
import perfolation.double2Implicits

import java.io.File

Expand Down Expand Up @@ -79,6 +80,11 @@ object ReportGenerator {
))
))
)
/*scribe.info(s"$name Total Time:")
nameAndReports.foreach {
case (name, reports) => scribe.info(s"\t$name: ${reports.logs.last.elapsed.f(f = 3)} seconds")
}
scribe.info("-------------------------")*/
quickChart.setConfig(chart.config)
quickChart.toFile(s"${outputDirectory.getName}/$name-total-time.png")
}
Expand Down
9 changes: 5 additions & 4 deletions benchmark/src/main/scala/benchmark/bench/Runner.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package benchmark.bench

import benchmark.bench.impl.{DerbyBench, H2Bench, LightDBBench, MongoDBBench, PostgreSQLBench, SQLiteBench}
import benchmark.bench.impl.{DerbyBench, H2Bench, LightDBAsyncBench, LightDBBench, MongoDBBench, PostgreSQLBench, SQLiteBench}
import fabric.io.JsonFormatter
import fabric.rw._
import lightdb.h2.H2Store
Expand Down Expand Up @@ -29,10 +29,11 @@ object Runner {
"LightDB-Map-SQLite" -> LightDBBench(SplitStoreManager(MapStore, SQLiteStore)),
"LightDB-HaloDB-SQLite" -> LightDBBench(SplitStoreManager(HaloDBStore, SQLiteStore)),
"LightDB-Lucene" -> LightDBBench(LuceneStore),
"LightDB-HaloDB-Lucene" -> LightDBBench(SplitStoreManager(HaloDBStore, LuceneStore, searchingMode = StoreMode.Indexes)),
"LightDB-RocksDB-Lucene" -> LightDBBench(SplitStoreManager(RocksDBStore, LuceneStore, searchingMode = StoreMode.Indexes)),
"LightDB-HaloDB-Lucene" -> LightDBBench(SplitStoreManager(HaloDBStore, LuceneStore)),
"LightDB-RocksDB-Lucene" -> LightDBBench(SplitStoreManager(RocksDBStore, LuceneStore)),
"LightDB-H2" -> LightDBBench(H2Store),
"LightDB-HaloDB-H2" -> LightDBBench(SplitStoreManager(HaloDBStore, H2Store, searchingMode = StoreMode.Indexes)),
"LightDB-HaloDB-H2" -> LightDBBench(SplitStoreManager(HaloDBStore, H2Store)),
"LightDB-Async-HaloDB-Lucene" -> LightDBAsyncBench(SplitStoreManager(HaloDBStore, LuceneStore)),
// "LightDB-PostgreSQL" -> LightDBBench(PostgreSQLStoreManager(HikariConnectionManager(SQLConfig(
// jdbcUrl = s"jdbc:postgresql://localhost:5432/basic",
// username = Some("postgres"),
Expand Down
Loading

0 comments on commit 3c8887e

Please sign in to comment.