3 ms·
It feels like some sort of a tree shaking solution in most of our modern development stacks is long overdue. If only we could get rid of dynamically called cod
by KronisLV 5y ago
It feels like some sort of a tree shaking solution in most of our modern development stacks is long overdue.
If only we could get rid of dynamically called code and instead could evaluate which code paths the code actually can call, then we'd be able to throw out about 90% of the contents of libraries, since most of the time noone actually uses all of that functionality.
Doing that with separate scripts is another approach, but it feels like the problem should be solved at its root.
- yummypaint 5y agoThis sounds like it could be equivalent to the halting problem
- herbstein 5y agoWith a conservative analysis it's possible to make an underestimation on the names one can remove. This shouldn't be done on object files but at a level where program flow information is still preserved. A flow-independent analysis using a superset lattice over the callable names should do the trick for a first-order implementation that will look good enough compared to shipping 37mb for google authentication. Further you could make it flow-sensitive for a more accurate analysis with the caveat that the runtime will be significantly longer.
- jitl 5y agoControl flow graphs are well-studied, critical parts of most compilers. The halting problem involves complexity of semantics in loops and jumps, but it’s possible to understand what loops may run just fine, without being able to decide exactly when a loop may exit. In many cases Clang and GCC compiler can easily understand loops, and even reduce them to constant time.
- MortenToudahl 5y agoIt sounds like what's already available in C#. https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming-options https://docs.microsoft.com/en-us/dotnet/core/deploying/trimm...