Skip to content

v0.7.0

Compare
Choose a tag to compare
@kyri-petrou kyri-petrou released this 12 Apr 04:44
· 33 commits to series/2.x since this release
37d358a

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 CompletedRequestMaps. If your code relies on creating custom DataSources, 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

Full Changelog: v0.6.1...v0.7.0