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

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

If the user hasn't specified that we are supposed to run on any executor then after zio.onExecutor(executor) completes we continue executing on the current executor for efficiency.

However, we should return to the default executor the next time we yield since we are incurring the cost of a yield regardless so we don't continue running on a potentially suboptimal executor indefinitely.

This requires keeping track of one more piece of information in the runtime of the executor that is currently running the fiber so we know when we shift to a new executor whether we actually need to yield or whether we happen to already be running on that executor.

@adamgfraser adamgfraser requested a review from jdegoes January 24, 2023 23:35
@jdegoes
Copy link
Member

jdegoes commented Jan 27, 2023

This is a great change and was also implemented in the old runtime. 👍

@jdegoes jdegoes merged commit ffc0ba6 into zio:series/2.x Jan 27, 2023
@jdegoes
Copy link
Member

jdegoes commented Jan 27, 2023

If you have the chance, would be good to add a test for this to ensure we don't break. 👍

@adamgfraser adamgfraser deleted the blocking branch January 27, 2023 13:10
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