Earlier quoted context omitted.
Proving yet again that there aren’t enough gardeners in computer science. The metaphor we use for optimization is “low hanging fruit” which no orchard owner would ever do. It’s massively wasteful, be you a programmer or a farmer. It’s what amateurs do. I do tree shaking. Pick a tree (subject matter in the code) and get all of the fruit that’s willing to fall off before moving to the next. It’s more efficient, more ef…
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…
Tree-shaking, the horticulturally misguided algorithm (2023)
71–80 of 151 posts
Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#72https://www.reddit.com/r/FlutterDev/comments/f4h3l9/tree_sha...
Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#73Earlier quoted context omitted.
> browsers have various popular language runtimes (and perhaps even popular libraries) preloaded, so that all web pages requiring that runtime can share the same (read-only) copy of that code. That sounds a lot like the idea from some years past that commonly used JavaScript frameworks would be served from a few common CDNs and would be widely enough used to be almost always in cache in the browser, and therefore won…
These are good questions and I think there's more than one answer that's worth exploring. I think that the privacy problems caused by shared caches could be solved, without simply prohibiting them altogether. Like, what if you only use the shared cache after N different web sites have requested the same module? But if we really can't get around that problem, then I think another approach worth exploring is for there…
That would still let websites perform timing attacks to deanonymise people. There's no way to verify that "N different websites" isn't just the same website with N different names.
Though, we could promote certain domains as CDNs, exempt from the no-shared-cache rules: so long as we added artificial delay when it "would have" been downloaded, that'd be just as safe. We're already doing this with domains (HSTS preload list), so why not CDNs?
Web browser developers seem to labour under the assumption that anyone will use the HTML5 features they've so lovingly hand-crafted. Who wants something as complicated as:
Eat me
Lorem ipsum and so on and so forth…
when we have the stunning simplicity of:
Eat me
Lorem ipsum and so on and so forth…
Example modified from https://mui.com/material-ui/react-accordion/. Though, in fairness, the developer UX is much better:
Eat me
Lorem ipsum and so on and so forth…
Maybe the problem isn't the libraries. Maybe the problem is us.Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#74Earlier 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.
Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#75Maybe off-topic. But can't you use WASM to create GUI's like Photoshop, with no JavaScript or DOM? Isn't the bigger goal of GUI's on WASM is we can jettison JavaScript/DOM and go back to writing GUI's like 10-20 years ago, with simpler libraries. Like SKIA, or something. Using non-web GUI libraries, since they could be compiled to WASM and run in web. EDIT: Native. I mean pre-web, when GUI libraries were native, ever…
Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#76This 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…
Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#77Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#78Earlier quoted context omitted.
Proving yet again that there aren’t enough gardeners in computer science. The metaphor we use for optimization is “low hanging fruit” which no orchard owner would ever do. It’s massively wasteful, be you a programmer or a farmer. It’s what amateurs do. I do tree shaking. Pick a tree (subject matter in the code) and get all of the fruit that’s willing to fall off before moving to the next. It’s more efficient, more ef…
> and cutting it there I think the idea behind calling it "shaking" is these branches and leaves that are already cut (inaccessible from the root), and just need a strong breeze to shake the tree and make them fall out.
We had an ice storm this year and there are loads of them all over town still.
Re: Tree-shaking, the horticulturally misguided algorithm (2023)
#79Earlier 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?
Some new developers might be introduced to the concept initially as "tree-shaking". It's not wrong; it just differs from your preference.