DEV Community

The run-time, compile-time, binary size triangle

Sandor Dargo on January 04, 2023

Often we start software development, we only care about writing some code. Or actually about writing the most amount of code that is possible. We o...
Collapse
 
pgradot profile image
Pierre Gradot

Stay tuned

OK I will XD

My assumption is that when we optimize for run-time performance, both the compilation time and the binary size will go up.

On the other hand, I also assume that we can make our executable smaller and at the same time, we can gain some compilation time while sacrificing a bit of our runtime performance.

My assumption is that they are often not related. See for instance this great article vector-of-bool.github.io/2020/10/0... : it's just about reducing compilation time.

Sometimes they can all be correlated in the same way. Eg: you simplify a code => it compiles faster, it is smaller, it runs faster.

I believe cases where there is a tradeoff between these 3 factors are the hard cases. Let's see what you have to tell about this :)

PS : talking about build time, I hope you know about ccache. I discovered only last year.... (and wrote an article about it dev.to/younup/recompiler-vos-proje...)

Collapse
 
sandordargo profile image
Sandor Dargo

Thanks for the articles, I add the first one to my reading list, I remember the second :) We also use ccache!

I think that there will be cases when it's hard to say what to do, but being aware of the different choices and make conscious decisions is already a good thing.