Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the event loop fiber #8173

Merged
merged 1 commit into from
Sep 11, 2019

Conversation

waj
Copy link
Member

@waj waj commented Sep 10, 2019

Since the commit 284fb1e there is actually no need to have a dedicated fiber to run the event loop. This is because now the event loop callbacks do not resume fibers directly and also it's not executing in endless non-returning mode.

With these changes the event loop is executed by any fiber that calls for a reschedule and there are no more fibers in the queue. This removes an extra context switch in those cases and provide a small but noticeable performance improvement for IO intensive apps.

…fiber when there are no more runnable fibers in the queue.
@jkthorne
Copy link
Contributor

Does this have a performance bump?
Have you seen this thread https://forum.crystal-lang.org/t/multithreaded-crystal-initial-thoughts/1089

@waj
Copy link
Member Author

waj commented Sep 10, 2019

@wontruefree yes, I've seen that thread and yes, it should have a performance improvement although don't expect it to be really big. It just removes an extra context switch made every time there are no more runnable fibers and the runtime holds on the event loop for something to happen.

@waj waj merged commit 7567f3d into crystal-lang:master Sep 11, 2019
@waj waj deleted the feature/remove-event-loop-fiber branch September 11, 2019 15:05
@sdogruyol
Copy link
Member

For the curious and @wontruefree this might be a pointer of the performance boost 👍 https://twitter.com/sdogruyol/status/1171814376212508672

@jkthorne
Copy link
Contributor

I thought there might be a performance boost. I was just curious if you had measured it since you removed some code.

@bcardiff bcardiff added this to the 0.31.0 milestone Sep 16, 2019
dnamsons pushed a commit to dnamsons/crystal that referenced this pull request Jan 10, 2020
…fiber when there are no more runnable fibers in the queue. (crystal-lang#8173)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants