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

Added Github Actions CI #17

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

TheTechsTech
Copy link

@TheTechsTech TheTechsTech commented May 9, 2023

The coro_timing.c is comparing sub functions calls to coroutine calls.

This mco_resume is much slower, library needs optimizing, test converted from https://github.com/higan-emu/libco/blob/master/doc/examples/test_timing.cpp

minicoro:

context-switching timing test

1.366 seconds per 50 million subroutine calls (500000000 iterations)
34.548 seconds per 100 million mco_resume calls (500000000 iterations)
mco_resume skew = 25.295826

libco:

context-switching timing test

1.326 seconds per 50 million subroutine calls (500000000 iterations)
6.071 seconds per 100 million co_switch calls (500000000 iterations)
co_switch skew = 4.577628x

@dumblob
Copy link

dumblob commented Jun 13, 2023

Wow, what a difference with resume. Thanks for spotting and all the time and effort you invested into the "coroutine business"!

@TheTechsTech
Copy link
Author

I went a totally different direction instead, moved most of my ideas into https://github.com/symplely/c-coroutine.

The library here has too many shortcomings, and can't move belong the not so low level.

@RandyGaul
Copy link
Contributor

@TheTechsTech Could you please write more here about the differences, including summary of the ideas and various changes? The pros/cons of the tradeoffs, what kind of work is necessary to go from what's in mini_coro.h to what you have there?

@RandyGaul
Copy link
Contributor

Specifically, I'm interested in performance related changes. So if you have other changes going on about the API or making things higher level, I would be really interested in separating those from any perf related stuff.

@edubart
Copy link
Owner

edubart commented Jun 13, 2023

I suspect he measured i686 which has no assembly backend, not x86_64, or measured some noise. I don't bet in 6x factor speed-up unless he is not saving floating point state (which is dangerous) or doing some other dangerous trick. I already measured before that on x86_64 Windows and it took 33 CPU cycles which was already pretty low, 6x factor speedup would mean in a switch in ~5.5 CPU cycles and I don't think that is doable.

I would not bother switching to something that says to be more optimized than minicoro, minicoro is already pretty efficient when using the assembly backend and there is not much room to optimize further without consequences or feature removal. Unless you really need to target x86 32-bit which is not supported yet for the assembly backend.

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.

4 participants