Live data from Hacker News

Tree-shaking, the horticulturally misguided algorithm (2023)

wingolog.org

81–90 of 151 posts

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#82
post #71

Earlier quoted context omitted.

I believe low hanging fruit is not specific to CS. Regardless, it is a perfect metaphor. You want to eat an apple: which one do you pick? Taking the low-hanging fruit is less work right now and gets you to your immediate goal, but disregards general efficiency. Sure, picking a whole tree is more efficient. But if you want a single apple, taking the low hanging fruit is the fastest approach. The metaphor works because…

As I said, it’s what amateurs do. We are not amateurs.

It's still a good metaphor. Nobody said picking low hanging fruit is the best approach in harvesting fruit or in computer science.

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#83
post #71

Earlier quoted context omitted.

I believe low hanging fruit is not specific to CS. Regardless, it is a perfect metaphor. You want to eat an apple: which one do you pick? Taking the low-hanging fruit is less work right now and gets you to your immediate goal, but disregards general efficiency. Sure, picking a whole tree is more efficient. But if you want a single apple, taking the low hanging fruit is the fastest approach. The metaphor works because…

As I said, it’s what amateurs do. We are not amateurs.

Everyone, even the amateurs and complete non–gardeners, know that this is not the best way to pick fruit. The whole point of the phrase is to point out that someone was lazy. It is saying that all they did was the absolute minimum amount of work.

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#84
post #2

Tree-shaking is such a bad misnomer. Virgil's compiler calls this "reachability analysis" and it's built into the compilation model. The compiler will parse and typecheck a program's (and libraries' code), and run initializers, but after that the compilation proceeds by exploring from the main entrypoint(s) and only reachable code is analyzed and ends in the final binary. It will happily generate a program (without r…

> Tree-shaking is such a bad misnomer.

I don't think so. I never considered tree-shaking to refer to the plants, rather the data structure.

If you imagine the diagram of some source code as a physical object, then shaking it would cause anything unreachable from the root to fall away.

I really don't see how reachability analysis is any different. One term just invokes a more spacial sense of reasoning.

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#85
post #15

This article is very correct: Wasm has a code size problem. This is a problem in browsers because all that code has to be downloaded to start the site. It's also a problem for serverless architectures, where code is often loaded from cold storage to a specific server on-demand while a client waits. Tree-shaking might help, but I feel like it's only an incremental optimization. Fundamentally the reason Wasm programs a…

Lot I don't know about how browsers are shipped, but it seems to me like browsers could easily get away with packing in a few languages and their STLs as part of their default installs. Python is what, 25MB? Would another couple hundred megs of disk space be such a big deal?

Possibly – if you can find a single version of Python that everybody will be happy with, forever.

Being able to cache runtimes and libraries like that across sites would be nice, though (but probably enables fingerprinting, so one Python runtime per origin it is).

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#87
post #46

Earlier quoted context omitted.

dead branches and loose leaves are connected to a real tree in the same way that dead code is connected to the program in a file. if you break off the dead branch, nothing happens to the tree, just like when you remove unused code, nothing happens to the program.

> if you break of the dead branch, nothing happens to the tree, just like when you remove unused code, nothing happens to the program. Indeed, and this has been known since the 80s as dead code elimination. So why are we using a new, less descriptive, more confusing term again?

[flagged]

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#88
post #71

Earlier quoted context omitted.

I believe low hanging fruit is not specific to CS. Regardless, it is a perfect metaphor. You want to eat an apple: which one do you pick? Taking the low-hanging fruit is less work right now and gets you to your immediate goal, but disregards general efficiency. Sure, picking a whole tree is more efficient. But if you want a single apple, taking the low hanging fruit is the fastest approach. The metaphor works because…

As I said, it’s what amateurs do. We are not amateurs.

[dead]

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#89
post #2

Tree-shaking is such a bad misnomer. Virgil's compiler calls this "reachability analysis" and it's built into the compilation model. The compiler will parse and typecheck a program's (and libraries' code), and run initializers, but after that the compilation proceeds by exploring from the main entrypoint(s) and only reachable code is analyzed and ends in the final binary. It will happily generate a program (without r…

> Tree-shaking is such a bad misnomer. I don't think so. I never considered tree-shaking to refer to the plants, rather the data structure. If you imagine the diagram of some source code as a physical object, then shaking it would cause anything unreachable from the root to fall away. I really don't see how reachability analysis is any different. One term just invokes a more spacial sense of reasoning.

[flagged]

Re: Tree-shaking, the horticulturally misguided algorithm (2023)

#90
post #2

Tree-shaking is such a bad misnomer. Virgil's compiler calls this "reachability analysis" and it's built into the compilation model. The compiler will parse and typecheck a program's (and libraries' code), and run initializers, but after that the compilation proceeds by exploring from the main entrypoint(s) and only reachable code is analyzed and ends in the final binary. It will happily generate a program (without r…

Many things in software are misnomers. Personally, I think it’s an amazing name. The first time I saw the term, I knew exactly what it was without any further research. You shake a tree to remove the loose things. In this case, it was clear that unused packages are being “shaken” from the tree.

The reason I didn't like the name when I first came across it is that I think of shaking the tree for harvesting the fruit. The fruit is what you want, not what you want to eliminate.

But it's an ok term overall.

Post reply on HN