v0.7.0
Release Notes
This release focuses heavily on improving the performance of query execution for DataSource-backed queries. Applications that heavily rely on ZQuery.fromRequest
for batching a large number of requests should see a notable improvement in performance. In v0.6.x, batching of ~1,000 unique requests to a single datasource would take approximately 1ms of CPU time according to our benchmarks. With this new release, batching of the same number of requests takes ~200-250us (~x4-5 improvement) 🚀
New additions
- Added multiple new constructor methods for
CompletedRequestMap
s. If your code relies on creating customDataSource
s, make sure to check them out! (see section below for more info) - Added an overload to
Cache.empty
that allows pre-sizing the underlying cache. This can improve performance in cases where there are a large number of requests
Deprecations
In order to improve performance as much as possible, the internals of Cache
and CompletedRequestMap
were re-written to utilize mutable data structures, which offer much better performance than immutable ones. In order to avoid mutability leaking into existing user's code, the ++
, insert
and insertOption
on CompletedRequestMap
remain immutable but have been deprecated as they'll lead to sub-optimal performance.
Users that construct DataSource
and CompletedRequestMap
manually, should migrate their existing code to use one of the many new constructors added in the CompletedRequestMap
companion object instead. See below for some migration examples:
Single request:
val request = ???
// v0.6.x
CompletedRequestMap.empty.insert(request, Exit.succeed(value))
// v0.7.0
CompletedRequestMap.single(request, Exit.succeed(value))
Iterable of (request, value)
:
case class GetId(id: UUID) extends Request[Nothing, GetId]
case class Response(value: String)
val keysAndValues: List[(UUID, String)] = ???
// v0.6.x
keysAndValues.foldLeft(CompletedRequestMap.empty) { case (map, (k, v)) => map.insert(GetId(k), Response(v)) }
// v0.7.0
CompletedRequestMap.fromIterableWith(keysAndValues)(kv => GetId(kv._1), kv => Response(kv._2))
All changes
- Optimize Datasource-based queries by @kyri-petrou in #467
- Update README.md by @zio-assistant in #468
- Unify
ZQuery.foreach
implementations and cleanups by @kyri-petrou in #469 - Optimize
CompletedRequestMap
by @kyri-petrou in #470 - Use
FiberId.None
when creating Promises by @kyri-petrou in #471 - Additional
CompletedRequestMap
constructors and deprecations by @kyri-petrou in #473 - Update README to show new
CompletedRequestMap
constructors by @kyri-petrou in #472 - Update ZIO version and increase SBT memory by @kyri-petrou in #475
- Update README.md by @zio-assistant in #474
Full Changelog: v0.6.1...v0.7.0