Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@guizmaii
Copy link
Member

I'm not an expert on this @specialized annotation. So I'm a 100% sure about this change

Seen in a profiling session on zio-kafka:

--- 20000000 ns (0.08%), 2 samples
  [ 0] scala.runtime.BoxesRunTime.boxToBoolean
  [ 1] zio.Cause.isEmpty
  [ 2] zio.internal.FiberRuntime.isInterrupted
  [ 3] zio.internal.FiberRuntime.runLoop
  [ 4] zio.internal.FiberRuntime.evaluateEffect
  [ 5] zio.internal.FiberRuntime.evaluateMessageWhileSuspended
  [ 6] zio.internal.FiberRuntime.drainQueueOnCurrentThread
  [ 7] zio.internal.FiberRuntime.run
  [ 8] zio.internal.ZScheduler$$anon$4.run

…d in `Cause::isEmpty` introduce boxing

Seen in a profiling session on zio-kafka:
```scala
--- 20000000 ns (0.08%), 2 samples
  [ 0] scala.runtime.BoxesRunTime.boxToBoolean
  [ 1] zio.Cause.isEmpty
  [ 2] zio.internal.FiberRuntime.isInterrupted
  [ 3] zio.internal.FiberRuntime.runLoop
  [ 4] zio.internal.FiberRuntime.evaluateEffect
  [ 5] zio.internal.FiberRuntime.evaluateMessageWhileSuspended
  [ 6] zio.internal.FiberRuntime.drainQueueOnCurrentThread
  [ 7] zio.internal.FiberRuntime.run
  [ 8] zio.internal.ZScheduler$$anon$4.run
```
@guizmaii guizmaii changed the title Specialized Cause::foldLeft to Boolean as the usage of this method in Cause::isEmpty introduce boxing Specialized Cause::foldLeft to Boolean as the usage of this method in Cause::isEmpty introduces boxing Mar 28, 2023
Copy link
Contributor

@adamgfraser adamgfraser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is an issue we should just optimize isEmpty directly but I am skeptical that this is actually a material optimization. Where are you using isEmpty?

@guizmaii guizmaii closed this Mar 28, 2023
@guizmaii guizmaii deleted the spec_foldLeft_Cause branch March 28, 2023 15:10
@guizmaii
Copy link
Member Author

Superseded by #7959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants