Skip to content

Comment on Tiny Treeshaker: JavaScript tree shaking in 200 lines of codeparent

Comments

Most other compiled languages do dead code elimination, which sounds similar but is a little different. Think of dead code elimination as removing code that doesn't change the output, while tree shaking instead includes code that could run.

To apply this to python is interesting - if you were creating a packaged version, I could see "compiling" the code to a separate package with only the required imports.

Think of dead code elimination as removing code that doesn't change the output, while tree shaking instead includes code that could run.

Those are both dead code elimination. Webpack even says:

Tree shaking is a term commonly used in the JavaScript context for dead-code elimination.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.