3 ms·
Why did tree shaking as a phrase come to exist when “dead code elimination” had been around forever?
by sroussey 3y ago
Why did tree shaking as a phrase come to exist when “dead code elimination” had been around forever?
- Solvency 3y agowhy did "dead code elimination" come to exist when dead/dying trees have existed for millions of years?
- fweimer 3y agoIf it really originated in the Lisp context (as someone claimed here), it's because it's about as much about eliminating unnecessary data and metadata as it's about executable code.
- Sakos 3y ago1) What words persist or become mainstream has little to do with how old they are. Tree shaking is evocative and is probably more appealing/approachable to say than "dead code elimination", so it became the more popular term. 2) I was curious about which term actually came first. The first use of "dead-code elimination" I could find was this 1973 dissertation: https://research-repository.st-andrews.ac.uk/bitstream/handle/10023/22636/NicholasAlexandrakisMScThesis1973_original_C.pdf?sequence=1 https://research-repository.st-andrews.ac.uk/bitstream/handl... I couldn't find any use of the term "tree shaking" or "tree shaker" in the realm of computing on Google Scholar (it was all citrus tree or other arboreal topics, weird). The earliest discussion I could find with the word is this on comp.lang.lisp: https://groups.google.com/forum/#!topic/comp.lang.lisp/pspFr1XByZk https://groups.google.com/forum/#!topic/comp.lang.lisp/pspFr...
- zem 3y agoit's an evocative phrase, and sounds more colloquial than "dead code elimination". not hard to see why it caught on.
- gardenhedge 3y agoI like dead code elimination much better.
- p_l 3y agoTree-shaking originated because it wasn't just about unreachable code, but also all other kinds of data in a live image.
- munificent 3y ago"Dead code elimination" usually refers to smaller-scale compiler optimizations where within a function, you're discarding pieces of code that will never be reached. "Tree-shaking" refers to a whole-program analysis where you discard entire modules and functions if they are never invoked. They are conceptually the same, but a compiler author will likely have to implement them separately, so having two names helps.
- wruza 3y agoFeels like it became “usually” only recently, cause before “web2.0” DCE always meant eliminating both codepaths and unreachable symbols.
- flohofwoe 3y agoFWIW I never encountered 'tree shaking' in the C/C++ world (only in the Javascript world). Commonly in the C/C++ world, dead-code-elimination is used for anything that removes (or ignores in the first place) unused code and data. And I think with LTO it's all the same anyway (in the past there were a lot of gnarly details how the compiler/librarian actually created a static link library to avoid linking code that's not actually used, but that all doesn't matter anymore with LTO).