Skip to content

Commit

Permalink
Minor updates to benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Apr 6, 2024
1 parent dd29029 commit 7a5c41e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions benchmark/src/main/scala/benchmark/IMDBBenchmark.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ object IMDBBenchmark { // extends IOApp {
val io = for {
_ <- implementation.init()
_ = scribe.info("--- Stage 1 ---")
akasFile <- downloadFile(new File(baseDirectory, "title.akas.tsv"), Limit.Unlimited).elapsed
akasFile <- downloadFile(new File(baseDirectory, "title.akas.tsv"), Limit.OneMillion).elapsed
_ = scribe.info("--- Stage 2 ---")
totalAka <- process(akasFile.value, implementation.map2TitleAka, implementation.persistTitleAka).elapsed
_ = scribe.info("--- Stage 3 ---")
basicsFile <- downloadFile(new File(baseDirectory, "title.basics.tsv"), Limit.Unlimited).elapsed
basicsFile <- downloadFile(new File(baseDirectory, "title.basics.tsv"), Limit.OneMillion).elapsed
_ = scribe.info("--- Stage 4 ---")
totalBasics <- process(basicsFile.value, implementation.map2TitleBasics, implementation.persistTitleBasics).elapsed
_ = scribe.info("--- Stage 5 ---")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ object LightDBImplementation extends BenchmarkImplementation {

override def name: String = "LightDB"

override def init(): IO[Unit] = db.init(truncate = true)

override def map2TitleAka(map: Map[String, String]): TitleAkaLDB = TitleAkaLDB(
titleId = map.value("titleId"),
ordering = map.int("ordering"),
Expand Down Expand Up @@ -55,7 +57,7 @@ object LightDBImplementation extends BenchmarkImplementation {

override def get(id: String): IO[TitleAkaLDB] = db.titleAka.get(Id[TitleAkaLDB](id)).map(_.getOrElse(throw new RuntimeException(s"$id not found")))

override def findByTitleId(titleId: String): IO[List[TitleAkaLDB]] = db.titleAka.query.filter(TitleAkaLDB.titleId === titleId).search().compile.toList.flatMap(_.map(_.get()).sequence)
override def findByTitleId(titleId: String): IO[List[TitleAkaLDB]] = db.titleAka.query.filter(TitleAkaLDB.titleId === titleId).documentsStream().compile.toList

override def flush(): IO[Unit] = for {
_ <- db.titleAka.commit()
Expand Down

0 comments on commit 7a5c41e

Please sign in to comment.