|
|
|
|
|
by rurban
3999 days ago
|
|
You can only tree-shake a whole program compilation, but then you cannot use compilation units, modules and modularity efficiently. You have to choose one or the other. Every normal compiler implements simple (i.e. module level) dead-code elimination already. EDIT: Of course you could use static libs, which does pull in only used symbols, but then you cannot share them across apps and update independently. I implemented a tree shaker for my lisp and was very happy with it, esp. for delivery. Like Go does it nowadays. |
|
I feel like our computing infrastructure has gotten to the point that dynamically linked libraries are no longer a good choice. I think dynamic linking has only caused us problems at work (devs install Node deps on the staging server, forget to tell ops, service crashes when deployed in prod), and the memory/disk/transfer overhead are practically irrelevant at this point. The only remaining reason to have dynamic libs is the idea that they can be updated without help from upstream, but that really only works if the software is compatible with the latest libraries, which isn't always true.
Supposedly ProGuard has some cross-module dead code elimination for JARs, but I haven't tried it: http://proguard.sourceforge.net/