Releases: getkyo/kyo
v0.16.2
What's Changed
- [data] records more than 22 AsFields (#1006) by @road21 in #1013
- [stm] fix TTable index initialization by @fwbrasil in #1012
- core: exit KyoApp on failure by @hearnadam in #1031
- remove IO.unit by @fwbrasil in #1041
- [core] Fix SLF4J log levels by @hearnadam in #1046
There are a few new features that will be announced with 0.17.0
.
Full Changelog: v0.16.1...v0.16.2
Kyo 0.16.1
This release (0.16.1) temporarily disables the Scheduler's Singleton mechanism: #1011.
New Features
-
Scheduler integrations for Finagle and cats-effect: We've been observing positive results with
kyo-scheduler-zio
enabled for ZIO apps and this new version introduces integrations for both Finagle and cats-effect. For cats-effect, the integration enables replacing the defaultWorkStealingThreadPool
with Kyo's high-performance work-stealing adaptive scheduler via KyoSchedulerIOApp or KyoSchedulerIORuntime. Admission control needs to be manually wired like in ZIO's integration. For Finagle, the integration uses extension points in Finagle'sFinagleSchedulerService
andForkingScheduler
, redirecting allFuturePool
workload to Kyo's scheduler and automatically wiring the admission control in the server stack. The new module only needs to be in the classpath and Finagle locates it via service loading. These integrations should provide improved peak performance and scalability, especially in environments with CPU quotas due to the scheduler's CPU throttling mitigation via adaptive concurrency. These integration modules are isolated and don't include dependencies on the effect system. -
Stream improvements and integrations: As mentioned in the last release, improving Streams is a key effort for Kyo 1.0. This release includes an integration with Reactive Streams and Java's Flow, the ability to stream values from a channel and from Hub listeners, new tap and tapChunk methods, and extensions to read and write gzip compressed data.
-
Batched Channel operations: Both reads and writes to channels now support batching, reducing the coordination overhead to exchange values between fibers. Additionally, the new drainUpTo method enables taking values immediately available in the channel without parking while properly considering pending puts.
-
Records:
kyo-data
, an isolated module without a dependency on the effect system, now offers an implementation of records based on intersection types to track available fields and types. The encoding enables type-level constraints, for example restricting what fields can be used in specific APIs, provides a proper sub-type relationship between records, automatic derivation from case classes, and convenient type-safe field access. -
STM: TChunk, TSchedule, and TTable: The
kyo-stm
module now includes transactional versions of Chunk, Schedule, and a new record-based TTable, which offers a convenient API to store and query records with indexing support. The module also received some new optimizations. -
Render type class: A new type class for rendering text representations of values was introduced in
kyo-data
and implementations for common Kyo types were introduced. This is an important aspect for usability given Kyo's extensive use of opaque types, which can lose fidelity when transformed via the regulartoString
. -
Async.memoize and Async.never: Two new async combinators that respectively provide memoization of async computations and producing a computation that never completes.
-
Improved direct syntax: The direct syntax now provies extension methods .now and .later instead of
await
, which provides a more lightweight syntax. The.later
extension is designed as an advanced API to enable composition of lazy effectful computations withindefer
blocks. In addition, the module was restructured to provide more informative compile-time error reporting. -
Anchored and Jittered Schedules: The
Schedule
implementation inkyo-data
now offers a Schedule.anchored constructor for cron-like schedules and a jitter method to introduce schedule duration variation. The STM module now uses a jittered retry schedule to reduce the impact of retry storms. -
Emit and orDie combinators: The
kyo-combinators
module, which offers ZIO-like APIs, now includes extensions for the Emit effect and a new orDie combinator.
Improvements
-
IO now includes Abort[Nothing]: The
IO
effect now includes handling of unexpected panics viaAbort[Nothing]
. Computations that previously hadIO & Abort[Nothing]
in the pending set now can only includeIO
. -
IOPromise improvements:
IOPromise
, the underlying implementation ofFiber
, was fixed to ensure proper handling of non-fatal exceptions in callbacks and an optimization was implemented to avoid a nested AtomicReference allocation. -
Async as a super set of IO: A new Async.apply method was introduced to provide side-effect suspension and enable using
Async
as a super set ofIO
in most scenarios.IO
, the effect for side-effect suspension, andAsync
, the effect for handling asynchronous boundaries, had scaladocs improved to better explain the difference between these effects. For most users, usingAsync
directly is recommended to reduce the effect tracking overhead. -
KyoApp in JS: The implementation was fixed to avoid thread blocking so ScalaJS is properly supported.
-
New kyo-kernel module: The kernel of the library is now isolated from all effect implementations. Additionally, the module was restructured and its scaladoc documentation is improved.
-
Better exceptions: Exceptions for Kyo's APIs now extend a common KyoException base type, which provides better error reporting via Frame.
-
Chunk improvements: The implementation was optimized by extending
StrictOptimizedSeqOps
and providing more efficientiterator
,take
,appended
methods. Additionally, more methods now return aChunk
instead ofSeq
for better usability and a bug in the implementation was fixed. -
Scheduler improvements: Task preemption is now avoided in case the worker doesn't have other pending workload, parameters were tuned to provide a behavior similar to cats-effect's default scheduler, the distribution of the random number generation used for scheduling decisions was improved, and a mechanism was introduced to ensure Kyo's scheduler is a singleton even in the presence of multiple class loaders.
Breaking Changes
-
More clear method naming: The methods provided by
Console
now use more explicit naming by spellingLine
instead ofln
, atomic classes now providecompareAndSet
instead of the shortenedcas
,Emit.apply
was replaced byEmit.value
, andCheck.apply
was replaced byCheck.require
. -
Removed STM's initNow: The implementation in the STM module used to offer
init
andinitNow
to distinguish between transactional and non-transactional instantiation. This release removes allinitNow
methods and changesinit
to dynamically select transactional or non-transactional instantiation depending on the presence of an outer `STM.run...
v0.16.0
Kyo 0.16.0
New Features
-
Scheduler integrations for Finagle and cats-effect: We've been observing positive results with
kyo-scheduler-zio
enabled for ZIO apps and this new version introduces integrations for both Finagle and cats-effect. For cats-effect, the integration enables replacing the defaultWorkStealingThreadPool
with Kyo's high-performance work-stealing adaptive scheduler via KyoSchedulerIOApp or KyoSchedulerIORuntime. Admission control needs to be manually wired like in ZIO's integration. For Finagle, the integration uses extension points in Finagle'sFinagleSchedulerService
andForkingScheduler
, redirecting allFuturePool
workload to Kyo's scheduler and automatically wiring the admission control in the server stack. The new module only needs to be in the classpath and Finagle locates it via service loading. These integrations should provide improved peak performance and scalability, especially in environments with CPU quotas due to the scheduler's CPU throttling mitigation via adaptive concurrency. These integration modules are isolated and don't include dependencies on the effect system. -
Stream improvements and integrations: As mentioned in the last release, improving Streams is a key effort for Kyo 1.0. This release includes an integration with Reactive Streams and Java's Flow, the ability to stream values from a channel and from Hub listeners, new tap and tapChunk methods, and extensions to read and write gzip compressed data.
-
Batched Channel operations: Both reads and writes to channels now support batching, reducing the coordination overhead to exchange values between fibers. Additionally, the new drainUpTo method enables taking values immediately available in the channel without parking while properly considering pending puts.
-
Records:
kyo-data
, an isolated module without a dependency on the effect system, now offers an implementation of records based on intersection types to track available fields and types. The encoding enables type-level constraints, for example restricting what fields can be used in specific APIs, provides a proper sub-type relationship between records, automatic derivation from case classes, and convenient type-safe field access. -
STM: TChunk, TSchedule, and TTable: The
kyo-stm
module now includes transactional versions of Chunk, Schedule, and a new record-based TTable, which offers a convenient API to store and query records with indexing support. The module also received some new optimizations. -
Render type class: A new type class for rendering text representations of values was introduced in
kyo-data
and implementations for common Kyo types were introduced. This is an important aspect for usability given Kyo's extensive use of opaque types, which can lose fidelity when transformed via the regulartoString
. -
Async.memoize and Async.never: Two new async combinators that respectively provide memoization of async computations and producing a computation that never completes.
-
Improved direct syntax: The direct syntax now provies extension methods .now and .later instead of
await
, which provides a more lightweight syntax. The.later
extension is designed as an advanced API to enable composition of lazy effectful computations withindefer
blocks. In addition, the module was restructured to provide more informative compile-time error reporting. -
Anchored and Jittered Schedules: The
Schedule
implementation inkyo-data
now offers a Schedule.anchored constructor for cron-like schedules and a jitter method to introduce schedule duration variation. The STM module now uses a jittered retry schedule to reduce the impact of retry storms. -
Emit and orDie combinators: The
kyo-combinators
module, which offers ZIO-like APIs, now includes extensions for the Emit effect and a new orDie combinator.
Improvements
-
IO now includes Abort[Nothing]: The
IO
effect now includes handling of unexpected panics viaAbort[Nothing]
. Computations that previously hadIO & Abort[Nothing]
in the pending set now can only includeIO
. -
IOPromise improvements:
IOPromise
, the underlying implementation ofFiber
, was fixed to ensure proper handling of non-fatal exceptions in callbacks and an optimization was implemented to avoid a nested AtomicReference allocation. -
Async as a super set of IO: A new Async.apply method was introduced to provide side-effect suspension and enable using
Async
as a super set ofIO
in most scenarios.IO
, the effect for side-effect suspension, andAsync
, the effect for handling asynchronous boundaries, had scaladocs improved to better explain the difference between these effects. For most users, usingAsync
directly is recommended to reduce the effect tracking overhead. -
KyoApp in JS: The implementation was fixed to avoid thread blocking so ScalaJS is properly supported.
-
New kyo-kernel module: The kernel of the library is now isolated from all effect implementations. Additionally, the module was restructured and its scaladoc documentation is improved.
-
Better exceptions: Exceptions for Kyo's APIs now extend a common KyoException base type, which provides better error reporting via Frame.
-
Chunk improvements: The implementation was optimized by extending
StrictOptimizedSeqOps
and providing more efficientiterator
,take
,appended
methods. Additionally, more methods now return aChunk
instead ofSeq
for better usability and a bug in the implementation was fixed. -
Scheduler improvements: Task preemption is now avoided in case the worker doesn't have other pending workload, parameters were tuned to provide a behavior similar to cats-effect's default scheduler, the distribution of the random number generation used for scheduling decisions was improved, and a mechanism was introduced to ensure Kyo's scheduler is a singleton even in the presence of multiple class loaders.
Breaking Changes
-
More clear method naming: The methods provided by
Console
now use more explicit naming by spellingLine
instead ofln
, atomic classes now providecompareAndSet
instead of the shortenedcas
,Emit.apply
was replaced byEmit.value
, andCheck.apply
was replaced byCheck.require
. -
Removed STM's initNow: The implementation in the STM module used to offer
init
andinitNow
to distinguish between transactional and non-transactional instantiation. This release removes allinitNow
methods and changesinit
to dynamically select transactional or non-transactional instantiation depending on the presence of an outerSTM.run
transaction. -
Adopt With naming pattern: Methods that take a continuation function now use the
With
...
v0.15.1
What's Changed
- [monix] scaladocs by @fwbrasil in #899
- [stm] fix race condition during commit + enable Native by @fwbrasil in #901
- [data][prelude][core] Poll effect + handleFirst by @fwbrasil in #891
- [readme][build] make unused value warnings a compilation error by @fwbrasil in #905
Full Changelog: v0.15.0...v0.15.1
v0.15.0
This is yet another packed #Kyo release! ✨
-
Monix Integration: The new kyo-monix module implements integration with Monix's
Task
, similar tokyo-zio
andkyo-cats
. -
Multithreaded Scala Native: Support for Scala Native has been expanded to
kyo-scheduler
,kyo-core
,kyo-direct
,kyo-sttp
, andkyo-combinators
. Kyo's adaptive scheduler and high-performance async primitives can now be used in Native! -
STM Effect: A new STM effect is available in the
kyo-stm
module, including a TMap data structure. The implementation uses a fine-grained read/write commit-time lock mechanism designed to reduce retry likelihood and allow transactions to commit concurrently in more scenarios. -
Stream Improvements: Improving streams is a key effort toward Kyo 1.0. This release makes streams lazier and introduces a new Stream.rechunk API.
-
Async.gather: New async operators to execute multiple computations in parallel and gather successful results. The APIs allow specifying a maximum number of computations to wait for. Once gathering is complete, all remaining pending fibers are automatically interrupted.
-
Effect Isolates: A new mechanism in
kyo-prelude
providing MTL-like state isolation with rollback capabilities. Integrates withAsync
APIs and powers theSTM
effect's retry handling. -
Scheduler Improvements: The scheduler module now includes scaladocs clarifying its implementation and design decisions. Additionally, the scheduler's Admission Control mechanism is now exposed as a user-facing API in
kyo-core
. -
Batch Effect Simplification: The Batch effect has been enhanced to provide the same functionality without requiring the type parameter previously used to track effects from sources.
-
Gen and Check Support in kyo-test:
kyo-test
now provides a stronger integration withzio-test
, enabling users to mix zio/kyo effects in the same test suite. This unlocks the use ofGen
andcheck
. -
Chunk Builder: Chunk now provides a collection builder API for better integration with Scala Collections.
Full Changelog: v0.14.1...v0.15.0
v0.14.1
Improvements
- [core] more lightweight IO effect by @fwbrasil in #825
- [core] Resource improvements + Async.parallelGrouped by @fwbrasil in #824
- [kyo-zio] use:
Fiber.Runtime.UnsafeAPI#interrupt
method by @hearnadam in #833 - [prelude] kernel scaladocs + cleanups by @fwbrasil in #834
- [prelude] more generic Aspect by @fwbrasil in #839
- [prelude] Parse improvements by @fwbrasil in #823
- [prelude] Parse: readAspect + spaced + readWhile + by-name parsers by @fwbrasil in #843
Fixes
- [prelude] fix
Stream#drop
with small Chunks by @hearnadam in #826 - [prelude] provide Flat evidences for Loop.Outcome* by @fwbrasil in #822
- [kyo-data] avoid printing trees when Flat macro fails by @hearnadam in #840
- [core][combinators] workaround issue with nested boundaries by @fwbrasil in #850
- [core] fix interrupts in Fiber.parallelUnbounded by @fwbrasil in #835
Breaking changes
- [prelude][core] Remove
as
from the pending type + makeandThen
always discard by @fwbrasil in #827 - [prelude] remove unused type parameters in ArrowEffect.handle by @fwbrasil in #844
New Contributors
Full Changelog: v0.14.0...v0.14.1
v0.14.0
New Features
kyo-data
- Text: Optimized API for string manipulation that avoids copying the underlying char array.
- Schedule: A new data type for representing complex scheduling.
kyo-prelude
- Parse Effect: New effect with support for backtracking, lookahead, and cut operations. The Parse effect is implemented using
Var
to track parsing position andChoice
to evaluate multiple possible branches. The API is designed to provide a more intuitive experience by using an imperative-like approach for consuming inputs and evaluating alternatives, rather than composing parsers with special operators. The effect also supports incremental parsing through integration withStream
inParse.run
.
kyo-core
- Unsafe Queue and Channel: New protected
Unsafe
APIs added for both Queue and Channel. - Time Shift and Control: Clock introduces two new APIs:
Clock.withTimeControl
: Enables manual time controlClock.withTimeShift
: Allows speeding up or slowing down computation execution based on a factor
Additionally,Timer
has been merged intoClock
, ensuring both time control methods work with scheduled execution. For example:Clock.withTimeShift(factor = 2)(Clock.repeatWithDelay(2.seconds)(computation))
will schedule the computation every 1 second of wall-clock time, as the shift doubles the time passage speed.
- Monotonic Clock: New
Clock.nowMonotonic
method provides results based onSystem.nanoTime
for improved precision in time measurement.Clock.stopwatch
has been updated to use this feature. - Isolated Locals: New functionality prevents Locals from being automatically inherited by forked fibers through
Local.initIsolated
. This mechanism provides fiber identity by ensuring isolated locals remain within a computation's scope. - Reentrant Meters: Mutexes, semaphores, and rate limiters are now reentrant by default, with customization options to disable reentrancy. This feature uses isolated locals to track meters acquired by a fiber.
- Abort[Nothing] in Async: The Async effect now includes
Abort[Nothing]
by default to handle unexpected failures (panics in Kyo's terminology).
Other Changes
Timer
functionality has been moved toClock.repeat*
methods.- Added a new recommended compiler flag to ensure proper handling of Kyo computations.
- A bug was recently introduced in
Async.timeout
making interrupts not propagate correctly. This bug has been fixed and tests were added to ensure the feature works correctly withkyo-sttp
.
Benchmark Results cafc6d6 2024-10-30
Benchmark results for commit cafc6d6 on 2024-10-30
v0.13.2
New/Improved APIs:
- data: Schedule by @fwbrasil in #733
- Improves Retry API surface. Breaking.
- data: Instant improvements by @fwbrasil in #781
- core: more convenient Random customization by @fwbrasil in #782
- core: Log improvements by @fwbrasil in #783
- core: Console improvements by @fwbrasil in #785
- Exposes typed errors via
Abort[IOException]
- Exposes typed errors via
- core: simplify KyoApp by @fwbrasil in #780
- Merges
KyoApp.Unsafe.run*
to a singlerunAndBlock
method.
- Merges
Fixes
- core: Queue/Channel/Meter improvements and fixes by @fwbrasil in #765
- prelude/core: fix boundary inference with Abort by @fwbrasil in #772
- core: fix Fiber.race interrupts by @fwbrasil in #771
- tapir: propagate shutdown timeout to netty by @fwbrasil in #786
Updates
- Update cats-effect to 3.5.5 by @scala-steward in #788
- Update sbt, scripted-plugin to 1.10.4 by @scala-steward in #787
- Update logback-classic to 1.5.12 by @scala-steward in #779
- Update scala3-library to 3.5.2 by @scala-steward in #777
- Update http4s-dsl, http4s-ember-client to 0.23.29 by @scala-steward in #776
- Update sbt-ci-release to 1.9.0 by @scala-steward in #773
- Update zio-logging, zio-logging-slf4j2 to 2.3.2 by @scala-steward in #768
- Update sbt, scripted-plugin to 1.10.3 by @scala-steward in #769
- Update sbt-scoverage to 2.2.2 by @scala-steward in #770
Full Changelog: v0.13.1...v0.13.2
v0.13.1
New APIs
Abort.recover
: enables more convenient handling of errors. It supports safely selecting a subset of possible failures via a type union.Kyo.pure
: method meant to facilitate widening of pure values into Kyo computations in cases that the compiler can't automatically infer the widening.Result.contains
: a convenience method to check if the result contains aSuccess
with a specific value.SafeClassTag
now provides aCanEqual
instance.
Improvements
- The integration with ZIO now uses a more efficient internal encoding that doesn't require intermediate
Future
execution. API remains the same. - Fibers were changed from
Fiber[E, A]
toFiber[+E, +A]
, improving type inference, and new unsafe APIs were added. Duration.show
was improved to show the duration at the maximum possible resolution without losing information. It was previously always printing nanoseconds.Tag
s for common Kyo types were fixed to use a more compact representation.
Breaking changes
Maybe.Defined
was renamed toPresent
andMaybe.Empty
toAbsent
. Both are now available directly in thekyo
package.KyoApp.*
methods now require anAllowUnsafe
evidence.Aspect.apply
doesn't allow effects in its value input anymore.
Full Changelog: v0.13.0...v0.13.1