corosio produces much bigger binaries than asio #367
Replies: 7 comments 9 replies
|
Could you open the "discussions" tab on the corosio project? |
|
when i compile with clang18 i get:
|
|
so i'm not convinced of the promise of "smaller binaries" due to less template bloat. |
|
What could be the reason for this? |
|
In that simple corosio echo server, it's building ALL of corosio, including UDP, DNS resolution, thread pools, absolutely everything, and the linker can't get rid of it. ChatGPT is saying that corosio's So it's bringing in a lot of logic. Asio's |
|
@sgerbino Have you had a chance to look at this? is there a way to modularize the build? So only link to what you need ? Is it possible there is too much cross-talk inside corosio and capy and the libraries aren't linker friendly. |
|
I had AI work up an example in both asio and corosio and take measurements. As a project grows with more stream-generic functions and more stream types, the template version's binary grows with the product of the two (every function is recompiled for every stream type). With type-erased The echo demo is a poor demonstration of the advantage stated in WhyNotAsio. It has one stream type, which is the case where templates are smaller. When you get to protocol-level libraries with several stream types, dozens of stream-generic functions, you hit the crossover point where smaller binaries can be the result. Here's a gist of what I mean: https://gist.github.com/sgerbino/076b2112026d44918a8f5f946a9c1b62 Shrinking the binary (like the change we just made) will help to make the crossover point sooner rather than later. I'm sure there is more work we can do to get it even smaller. The lazy service registration was an obvious win (and what it should've done to begin with). |
Uh oh!
There was an error while loading. Please reload this page.
I'm comparing a simple echo server written in corosio and asio. I'm using the example echo server on the corosio webpage. I've attached the code. On my machine, compiling with gcc 14.2.0 i get the following binary sizes:
CMakeLists.txt
main_asio.cpp
main_corosio.cpp
All reactions