Skip to content

Commit

Permalink
give sizeHint
Browse files Browse the repository at this point in the history
  • Loading branch information
yoohaemin committed Jun 9, 2024
1 parent d5533c8 commit 05d4c39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zquery/src/main/scala/decrel/reify/zquery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ trait zquery[R] extends bifunctor.module[ZQuery[R, +*, +*]] {
val deduplicated = requests.distinctBy(_.id)

batchExecute(deduplicated.map(_.id)).flatMap { results =>
val resultsMap = mutable.Map
.newBuilder[In, Exit[E, Out]]
val mapBuilder = mutable.Map.newBuilder[In, Exit[E, Out]]
mapBuilder.sizeHint(results)
val resultsMap = mapBuilder
.addAll(results.view.map(pair => pair._1 -> Exit.succeed(pair._2)))
.result()
.withDefault(in =>
Expand Down

0 comments on commit 05d4c39

Please sign in to comment.