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

Why blocking I/O? #72

Open
emanuelpalm opened this issue Mar 16, 2021 · 2 comments
Open

Why blocking I/O? #72

emanuelpalm opened this issue Mar 16, 2021 · 2 comments

Comments

@emanuelpalm
Copy link

emanuelpalm commented Mar 16, 2021

Reading through the source code, I noticed that you seem to use blocking I/O with thread pools. My impression is that most languages are recommending either to use green threads (Go, Erlang, Java in the future) or async/await (C#, JavaScript, Dart) to avoid the comparatively high costs of OS thread switching. Skimming through the Internet, I noticed that async/await (called co-routines) are officially supported in C++20, but that support for it seems to exist for earlier C++ versions via e.g. Boost.Asio.

Do you have any particular reasons for avoiding co-routines?

@ng201
Copy link
Collaborator

ng201 commented Mar 20, 2021

Mainly because we use C++17.

It would be nice to have a co-routine based server, too, but I think that would be a second step. We tried to make every part of the code to be easy to change, thus, adding a different server is not a big deal. Actually, there was a boost asio based solution, but that increased the executable size by 8 MBytes...

Another sad situation is, that the std networking did not make it, and it is not part of the standard :(. Maybe that would be the real solution with differnet kind of executors.

@emanuelpalm
Copy link
Author

Sounds good! 8 MB is pretty crazy. Does the binary size increase that much if you enable LTO and strip it?

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

No branches or pull requests

2 participants