Re:Tree-shaking, the horticulturally misguided algorithm
by nurple on Saturday April 13, 2024 @01:51PM
(#40024744)
A lazy chunked delivery strategy like used in the k8s stargz-snapshotter[0] project could be effective here, where it only pulls chunks as needed, but it would probably require wasm platform changes.
Re:Tree-shaking, the horticulturally misguided algorithm
by kevindamm on Saturday April 13, 2024 @01:48PM
(#40024725)
There is a substantial risk there unless you can hit all the edge cases and error conditions when profiling. Even a good fuzzer can miss a very rare state. Then when you hit it in real use there's no code to handle it!
Profile-based optimization and JITting is plausible because the corner cases are still there, just not optimized.
Re:Tree-shaking, the horticulturally misguided algorithm
by screcth on Saturday April 13, 2024 @02:16PM
(#40024932)
I completely agree, that's why in that case you could download the missing code from the server and load it using dynamic linking.
The server would then mark it as reachable so it's delivered as part of the main bundle next time.
I would expect the bundle to converge quickly to the set of functions that are actually reachable.
Aditionally, it's very likely that the sets of reachable code of two versions of the same app have significant overlap, so the information collected for version N could be used as a starting point for N+1, and so on.
Re:Tree-shaking, the horticulturally misguided algorithm
by avodonosov on Saturday April 13, 2024 @07:17PM
(#40027093)
"less used functionality on-demand" - so the code to handle the rare case remains available, on demand.
Re:Tree-shaking, the horticulturally misguided algorithm
by avodonosov on Saturday April 13, 2024 @07:05PM
(#40027029)
I experimented with that for javascript: https://github.com/avodonosov/pocl
If tree-shaking was done based on production information it may be possible to prune a lot of dead/almost-dead code without having to implement sophisticated static analysis algorithms.