当前位置:网站首页>Tree Shaking和DCE
Tree Shaking和DCE
2022-07-28 10:29:00 【差不少】
Tree Shaking和DCE
Tree Shaking 指的就是当我引入一个模块的时候,我不引入这个模块的所有代码,我只引入我需要的代码,这就需要借助 webpack 里面自带的 Tree Shaking 这个功能来帮我们实现。
https://blog.csdn.net/weixin_45820444/article/details/108845845
Tree-shaking的本质是消除无用的js代码。无用代码消除在广泛存在于传统的编程语言编译器中,编译器可以判断出某些代码根本不影响输出,然后消除这些代码,这个称之为DCE(dead code elimination)。
Tree-shaking 是 DCE 的一种新的实现,Javascript同传统的编程语言不同的是,javascript绝大多数情况需要通过网络进行加载,然后执行,加载的文件大小越小,整体执行时间更短,所以去除无用代码以减少文件体积,对javascript来说更有意义。
Tree-shaking 和传统的 DCE的方法又不太一样,传统的DCE 消灭不可能执行的代码,而Tree-shaking 更关注宇消除没有用到的代码。下面详细介绍一下DCE和Tree-shaking。
边栏推荐
猜你喜欢

产品端数据分析思维

GKCylindersNoiseSource

Batch Normlization

剑指 Offer 35. 复杂链表的复制

SDUT Round 9 2020 Spring Festival campaign

I don't know how lucky the boy who randomly typed logs is. There must be a lot of overtime

Aike AI frontier promotion (7.28)

Two years of crud, two graduates, two months of preparation for the interview with ALI, and fortunately won the offer grading p6

SQL Server 2016 learning record - nested query

Particle swarm optimization to solve the technical problems of TSP
随机推荐
蓝桥杯嵌入式-HAL库-USART_TX
AP AUTOSAR platform design 1-2 introduction, technical scope and method
Start from scratch blazor server (2) -- consolidate databases
Yarn报错:Exception message: /bin/bash: line 0: fg: no job control
287. Find the Duplicate Number
samba服务器配置
GKARC4RandomSource
GKRidgedNoiseSource
Markdown to word or PDF
机器人技术(RoboCup 2D)如何进行一场球赛
机器人技术(RoboCup 2D)实验五十题及主要函数含义
GKPolygonObstacle
Machine learning -- handwritten English alphabet 3 -- engineering features
GKRandom
乱打日志的男孩运气怎么样我不知道,加班肯定很多
Excel word 简单 技巧 整理(持续更新 大概~)
GKObstacle
GKNoise
markdown转成word或者pdf
Tensorflow 知识点