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

can we take the good things from libfringe and put them into may/generator #31

Open
alkis opened this issue Jan 26, 2018 · 3 comments
Open

Comments

@alkis
Copy link
Contributor

alkis commented Jan 26, 2018

https://github.com/edef1c/libfringe

This crate has rather nice approach to switching contexts:

  • instead of saving all callee registers it issues asm to denote they are clobbered. Then the compiler saves only the registers that need saving
  • at least on unix it stitches back the stack so stack traces look legible
  • performance seems unparalleled: 3ns per context switch (granted only when a few registers are saved)
@Xudong-Huang
Copy link
Owner

That's an awesome good idea! Currently the context switch would cost about 30ns on unix, this would improve the performance significantly. We need to integrate it in the generator library. I also want grab some good things from parking_lot about the thread wakeup, but this should be another issue.

@Xudong-Huang
Copy link
Owner

I think this is done in the nightly build. just include following config in your application's Cargo.toml

[replace]
"generator:0.6.5" = { git = "https://github.com/Xudong-Huang/generator-rs.git", branch = "libfringe" }

this should replace all the dependent generator library by using the libfringe branch. Though the generator context switch is improved 2 times faster than the master branch, but it's not the critical bottleneck for coroutine tasks, so I didn't see much improvement for the heavy io test.

@Xudong-Huang
Copy link
Owner

for the stable branch use this feature we need to wait rust asm feature got stabled.

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

No branches or pull requests

2 participants