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

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

We can make this slightly faster by only looking up the definition of a fatal error if an exception is thrown.

@adamgfraser adamgfraser requested review from jdegoes and vigoo March 14, 2023 14:02
@adamgfraser
Copy link
Contributor Author

This does mean that if a fatal error does occur we need to execute one more workflow after that to get the definition of a fatal error so maybe this doesn't make sense.

@jdegoes
Copy link
Member

jdegoes commented Mar 14, 2023

I wonder if we should just intern it.

@adamgfraser
Copy link
Contributor Author

Isn't the problem that the definition of a fatal error is itself a regional setting stored in a FiberRef so for correctness we have to look it up at some point? We could move the whole thing into the runtime but I don't think it is worth it. In microbenchmarks ZIO.succeed is about 10% faster than ZIO.attempt right now and with this change that difference goes down to about 5%.

@jdegoes
Copy link
Member

jdegoes commented Mar 21, 2023

All right, sounds good to me.

@jdegoes jdegoes merged commit e920c19 into zio:series/2.x Mar 21, 2023
@adamgfraser adamgfraser deleted the attempt branch March 24, 2023 11:09
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.

3 participants