Deno 1.5使用新编译器,打包性能提升3倍

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"为JavaScript和TypeScript开发Deno运行时的团队最近"},{"type":"link","attrs":{"href":"https:\/\/deno.land\/posts\/v1.5?twitter","title":null,"type":null},"content":[{"type":"text","text":"发布"}]},{"type":"text","text":"了Deno 1.5。新版本通过使用基于Rust的JavaScript\/TypeScript编译器"},{"type":"link","attrs":{"href":"https:\/\/swc.rs\/","title":null,"type":null},"content":[{"type":"text","text":"swc"}]},{"type":"text","text":"来提高打包性能,并通过摇树优化进一步减少包的大小。Deno 1.5实现了alert、confirm和prompt等Web平台API,开发人员可以在终端编写简单的交互式应用程序。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Deno团队重构了Deno的TypeScript编译器基础架构,开始使用swc。swc是用Rust编写的JavaScript\/TypeScript编译器和打包器。swc声称单线程速度比Babel快20倍,在一次四核基准测试中快70倍。Deno 1.5的发布说明提到了swc对Deno编译性能的影响:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"当我们启用类型检查时,性能提升了3倍,如果开启--no-check选项,则提升15倍。"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"新的摇树优化能力进一步降低包的大小。发布说明给出了一个"},{"type":"link","attrs":{"href":"https:\/\/deno.land\/std\/http\/file_server.ts","title":null,"type":null},"content":[{"type":"text","text":"源码示例"}]},{"type":"text","text":",在使用v1.5而不是v1.4进行编译时,代码大小减少了35%。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Deno 1.5打好的包可以作为标准的ES模块发布。发布说明写道:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"动态导入现在可以正常工作,import.meta.url也可以正确设置。如果你使用Deno为浏览器打包代码,请确保将包作为ES模块加载(在
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章