Skip to content

Releases: getkyo/kyo

v0.16.2

23 Jan 21:54
96f5af6
Compare
Choose a tag to compare

What's Changed

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

14 Jan 02:52
733323e
Compare
Choose a tag to compare

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 default WorkStealingThreadPool 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's FinagleSchedulerService and ForkingScheduler, redirecting all FuturePool 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 regular toString.

  • 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 within defer blocks. In addition, the module was restructured to provide more informative compile-time error reporting.

  • Anchored and Jittered Schedules: The Schedule implementation in kyo-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 via Abort[Nothing]. Computations that previously had IO & Abort[Nothing] in the pending set now can only include IO.

  • IOPromise improvements: IOPromise, the underlying implementation of Fiber, 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 of IO in most scenarios. IO, the effect for side-effect suspension, and Async, the effect for handling asynchronous boundaries, had scaladocs improved to better explain the difference between these effects. For most users, using Async 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 efficient iterator, take, appended methods. Additionally, more methods now return a Chunk instead of Seq 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 spelling Line instead of ln, atomic classes now provide compareAndSet instead of the shortened cas, Emit.apply was replaced by Emit.value, and Check.apply was replaced by Check.require.

  • Removed STM's initNow: The implementation in the STM module used to offer init and initNow to distinguish between transactional and non-transactional instantiation. This release removes all initNow methods and changes init to dynamically select transactional or non-transactional instantiation depending on the presence of an outer `STM.run...

Read more

v0.16.0

13 Jan 20:22
9cdf197
Compare
Choose a tag to compare

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 default WorkStealingThreadPool 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's FinagleSchedulerService and ForkingScheduler, redirecting all FuturePool 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 regular toString.

  • 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 within defer blocks. In addition, the module was restructured to provide more informative compile-time error reporting.

  • Anchored and Jittered Schedules: The Schedule implementation in kyo-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 via Abort[Nothing]. Computations that previously had IO & Abort[Nothing] in the pending set now can only include IO.

  • IOPromise improvements: IOPromise, the underlying implementation of Fiber, 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 of IO in most scenarios. IO, the effect for side-effect suspension, and Async, the effect for handling asynchronous boundaries, had scaladocs improved to better explain the difference between these effects. For most users, using Async 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 efficient iterator, take, appended methods. Additionally, more methods now return a Chunk instead of Seq 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 spelling Line instead of ln, atomic classes now provide compareAndSet instead of the shortened cas, Emit.apply was replaced by Emit.value, and Check.apply was replaced by Check.require.

  • Removed STM's initNow: The implementation in the STM module used to offer init and initNow to distinguish between transactional and non-transactional instantiation. This release removes all initNow methods and changes init to dynamically select transactional or non-transactional instantiation depending on the presence of an outer STM.run transaction.

  • Adopt With naming pattern: Methods that take a continuation function now use the With...

Read more

v0.15.1

05 Dec 17:26
46e002e
Compare
Choose a tag to compare

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

04 Dec 05:40
5d5f0c7
Compare
Choose a tag to compare

This is yet another packed #Kyo release! ✨

  • Monix Integration: The new kyo-monix module implements integration with Monix's Task, similar to kyo-zio and kyo-cats.

  • Multithreaded Scala Native: Support for Scala Native has been expanded to kyo-scheduler, kyo-core, kyo-direct, kyo-sttp, and kyo-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 with Async APIs and powers the STM 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 with zio-test, enabling users to mix zio/kyo effects in the same test suite. This unlocks the use of Gen and check.

  • 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

20 Nov 03:37
0f3701d
Compare
Choose a tag to compare

Improvements

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 + make andThen 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

06 Nov 16:00
3726166
Compare
Choose a tag to compare

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 and Choice 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 with Stream in Parse.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 control
    • Clock.withTimeShift: Allows speeding up or slowing down computation execution based on a factor
      Additionally, Timer has been merged into Clock, 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 on System.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 to Clock.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 with kyo-sttp.

Benchmark Results cafc6d6 2024-10-30

30 Oct 20:34
Compare
Choose a tag to compare
Pre-release

Benchmark results for commit cafc6d6 on 2024-10-30

v0.13.2

29 Oct 16:27
c9f7e82
Compare
Choose a tag to compare

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]
  • core: simplify KyoApp by @fwbrasil in #780
    • Merges KyoApp.Unsafe.run* to a single runAndBlock method.

Fixes

Updates

Full Changelog: v0.13.1...v0.13.2

v0.13.1

17 Oct 20:12
3e5682b
Compare
Choose a tag to compare

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 a Success with a specific value.
  • SafeClassTag now provides a CanEqual 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] to Fiber[+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.
  • Tags for common Kyo types were fixed to use a more compact representation.

Breaking changes

  • Maybe.Defined was renamed to Present and Maybe.Empty to Absent. Both are now available directly in the kyo package.
  • KyoApp.* methods now require an AllowUnsafe evidence.
  • Aspect.apply doesn't allow effects in its value input anymore.

Full Changelog: v0.13.0...v0.13.1