BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Deno 1.5 Sees 3x Bundling Performance Improvement Due to Rust-Based JavaScript/TypeScript Compiler

Deno 1.5 Sees 3x Bundling Performance Improvement Due to Rust-Based JavaScript/TypeScript Compiler

This item in japanese

Bookmarks

The team behind the Deno runtime for the JavaScript and TypeScript recently released Deno 1.5. This new version improves bundling time by using Rust-based JavaScript/TypeScript compiler swc, and further reduces bundle size with tree-shaking. Deno 1.5 implements the alert, confirm, and prompt web platform APIs. This may allow developers to write simple interactive applications in the terminal.

Deno’s team refactored Deno’s TypeScript compiler infrastructure to use swc. The latter is a JavaScript/TypeScript compiler and bundler written in Rust. Swc claims to be 20 times faster than the Babel compiler on a single thread — and 70 times faster on one four-core benchmark. Deno 1.5’s release notes commented on the impact of swc on Deno’s compilation performance:

This has led to a 3x performance improvement when we type-check your code, and up to a 15x improvement if you use the --no-check flag.

The new tree-shaking abilities translate into reduced bundles. The release note gave an example of source code that saw a 35% size reduction when compiled with v1.5 instead of v1.4.

Bundles in Deno 1.5 are now emitted as standard ES modules. The release explained:

Dynamic imports will work correctly now, and import.meta.url is also set correctly. If you were using Deno to bundle code for the browser, make sure to load the bundle as an ES module now (type="module" attribute on your <script> tag).

The new Deno release implements the web platform APIs alert, confirm, and prompt with similar semantics as in the browser. For instance, in the browser, Window.prompt displays a dialog with an optional message prompting the user to input some text. In a Deno terminal, the prompt function will similarly prompt the user and block synchronously till that input is received.

The mentioned APIs may allow developers to implement simple interactive interactions in the terminal. The release note provides a trivial example:

Deno interactive instructions

Prompting the user for input in Node.js may require that developers manipulate I/O streams directly (e.g., process.stdin) or through a library.

The new Deno release also improves the REPL with the addition of several new features. Object properties and methods can be completed within the REPL by pressing the TAB key. Code may be syntax-highlighted if the terminal supports colors. The REPL also now supports top-level await instructions.

The release note details additional minor features that are part of the release. Developers who are interested may review the release note online.

Deno is open-source software available under the MIT license. Contributions are encouraged via the Deno Project and should follow the Deno contribution guideline.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT