TypeScript Generics
Generics
1 | function foo<T>(arg: T): T { |
Generics Types
1 | function foo<T>(arg: T): T { |
1 | function foo<T>(arg: T): T { |
1 | function foo<T>(arg: T): T { |
Node.js is built on Google’s V8 engine, and V8’s garbage collection mechanism is one of its core performance features. In this article, we’ll explore the three primary garbage collection algorithms used in V8: Mark-Sweep, Mark-Compact, and Scavenge, along with their working principles and application scenarios.
Before diving into garbage collection algorithms, we need to understand V8’s memory partition model. V8 divides memory into two main regions:
通过改写[].__proto__上的方法,实现对Array原生方法的拦截。
源码位置为 /core/instance/observer/array.js
1 | // cache the original Array.prototype |
Vite 的速度优势主要来源于其基于原生 ESM(ES Modules)的开发模式和高效的构建过程。
<script type="module">,可以动态加载 ESM 模块,Vite 的开发服务器将源码直接以 ESM 格式提供给浏览器。