JavaScript WeakRefs and TC39 standardization


嘉宾 : Daniel Ehrenberg | TC39核心成员

会议室 : 宴会厅3


专题演讲嘉宾:Daniel Ehrenberg

TC39 核心成员

Daniel is an engineer at Igalia, an open source software cooperative. He participates in the TC39 and has dabbled in WebAssembly and web standards. He also worked on V8.

Daniel 是 TC39 的核心成员,他就职于 Igalia,这是一家自由软件咨询公司,希望通过自由软件让世界更美好。Daniel 还涉猎 WebAssembly 和 Web 标准,也参与了 V8 的开发。


演讲:JavaScript WeakRefs and TC39 standardization

TC39 is the committee which defines the JavaScript standard. JavaScript developers have been telling us for many years that they need weak references and finalizer callbacks: These capabilities let programs hook into garbage collection to free up related resources. After several years of debate and refinement, TC39 has settled on a design for WeakRefs and FinalizationGroups which has reached Stage 3 in its process and will likely soon be shipping in browsers and Node.js. In this talk, I will explain how to use WeakRefs, as well as how TC39 works and how to get involved, so that we can work together for the future of JavaScript.

1.  Use cases for WeakRefs and FinalizationGroups

    (1) In-memory cache
    (2) Triggering errors on stranded resources
    (3) Using WebAssembly memory from JavaScript
    (4) In-memory cache with tombstone cleanup

2.  How TC39 develops JavaScript

    (1) What is TC39?
    (2) Development of the JavaScript standard
    (3) TC39 stage process
    (4) Some recent TC39 proposals

3.  Details of WeakRefs in TC39

    (1) History of this proposal in TC39
    (2) WeakRef and FinalizationGroup APIs
    (3) Weak guarantees in WeakRef/FinalizationGroup behavior
    (4) Scheduing interactions with deref() and FinalizationGroup callbacks

4.  Participating in TC39

    (1) Giving feedback on proposals via GitHub
    (2) Helping with tests and documentation
    (3) Creating implementations in Babel, tools, JS engines, etc
    (4) Joining Ecma to be a TC39 delegate

Audience benefits:

1.  Learn to use the new JavaScript WeakRefs feature
2.  Get involved in shaping the future of JavaScript through TC39

Frontier highlights:

WeakRefs and FinalizationGroups can lead to more precise, efficient memory consumption in modern JavaScript

Knowledge reserve:

1.  Know simple JavaScript
2.  Understand what garbage collection is


Javascript Weakrefs 和 TC39 标准化


TC39 委员会负责制定 JavaScript 标准。多年来,JavaScript 开发人员一直告诉委员会,他们需要弱引用和 Finalizer 回调:这些功能使得程序可以连接到垃圾收集中,以释放相关资源。经过几年的争论和改进,TC39 已经确定了 WeakRefs 和 FinalizationGroups 的一种设计方案,目前已经到了第3阶段,可能很快就会在浏览器和 Node.js 中发布。在本次演讲中,我将解释如何使用 Weakrefs,然后介绍 TC39 是如何工作的,以及如何参与其中,以便大家能够为 JavaScript 的未来共同努力。

1.  WeakRefs和FinalizationGroups的用例

(3)使用 JavaScript 中的 WebAssembly 内存

2.  TC39 如何开发 JavaScript

(1)什么是 TC39?
(2)JavaScript 标准的发展过程
(3)TC39 阶段流程
(4)近期 TC39 的一些建议

3.  TC39 中的 WeakRefs 细节

(1)TC39 中本提案的历史
(2)WeakRef 和 FinalizationGroup API
(3)WeakRef/FinalizationGroup 行为中的弱保证
(4)调度与 deref
(5)和 FinalizationGroup 回调的交互

4.  参与TC39

(1)通过 GitHub 反馈提案
(3)在 Babel、工具、JS 引擎等中创建实现
(4)加入 Ecma 成为 TC39 代表


1.  学习使用新的 JavaScript WeakRefs 特性
2.  通过 TC39 参与塑造 JavaScript 的未来


WeakRefs 和 finalizationgroup 可以使现代 JavaScript 中的内存使用更精确、更高效。


1.  了解简单的 JavaScript
2.  了解什么是垃圾收集


© 2020 Baidu - GS(2019)5218号 - 甲测资字1100930 - 京ICP证030173号 - Data © 长地万方