6

Recently, Deno's official blog reviewed the major events and new changes that have occurred in the project in 2021.

A year of Deno's first funding, the company has seen strong and ongoing growth in 2021 in 10 areas: 44 releases (11 minor, 33 patches), landing key features, numerous bugs fixes and significant performance optimizations.

In this blog post, Deno discusses the following major developments:

Deno Deploy

In the summer of 2021, Deno officially released the first beta version of Deno Deploy - a modern serverless cloud built from the ground up by the Deno engineering team, allowing users to quickly deploy JavaScript, TypeScript and WASM services to data centers around the world .

Currently, Deno is actively developing and investing in Deno Deploy, which is considered the company's third JavaScript runtime after building Node.js and Deno CLI.

Optimizing the Deno kernel

Deno's kernel provides "opcalls" (similar to syscalls) that allow JavaScript to call functions provided by the runtime (fs/net/url-parsing/…).

Before the v1.9 release, Deno used a mix of JSON and binary buffers to sanitize opcall values.

The efficiency of the op-layer is a key indicator that determines the overall performance of the runtime. Compared with the previous cost of about 4000ns per call to Opcalls, each call now costs only about 40ns, a reduction of nearly 100 times. The main reason for these efficiency gains is serde_v8 - the maximum efficient bijection between Rust and V8 values that the development team designed and delivered in v1.9.

This alone reduces the cost of common operations like URL parsing by more than 3x and makes Deno a fast JS runtime.

native HTTP

In Deno v1.9 the development team provided native HTTP server bindings, which were later stabilized in Deno v1.13, creating a high-performance HTTP server powered by hyper with just a few lines of code:

import { serve } from "https://deno.land/std@0.121.0/http/server.ts";
serve((_req) => new Response("Hello, world"), { port: 3000 });
console.log("Listening on http://localhost:3000");

MDN Compatibility Matrix

In August 2021, Deno was added to the MDN compatibility table.

Deno takes web compatibility very seriously, and the development team tests Deno against WPT (or Web Platform Testing), a test suite used by all major browsers to ensure compliance with the specification. (Test suite results are available at wpt.fyi).

Foreign Function Interface (FFI)

In Deno v1.13, the development team replaced the unstable plugin system with a new foreign function interface API. Although the FFI is still considered unstable, the team sees this as a significant improvement.

The native plugin system prior to version 1.13 allowed publishing dynamic libraries written in Rust, and due to the unstable Rust ABI, as well as limiting API authors to a single language, the team decided to replace the system with a generic FFI API. This API allows developers to write "extensions" for the Deno runtime in any language that uses the C calling convention.

So far, I've seen some interesting projects using the FFI API to demonstrate the power of the FFI API:

Desktop app framework
Python interpreter bindings
SDL2 bindings
SerialPort bindings
SQLite bindings
Slack & Next Generation Platform

In November 2021, SLACK announced its next-generation development platform based on Deno. In addition to SLACK, the Deno Company has partnered with other partners to manufacture and ship high-quality Deno-powered products. Deno believes that Deno Deploy's "Isolates as a Service" provides a solid foundation for:

Modern edge-hosting
User-extendable platforms (bots, plugins, apps, etc...)
Low-code solutions

Node.js compatibility

In Q4 2021, the Deno team started working to provide best-in-class Node.js compatibility, allowing Deno to run applications and libraries (NPM packages) developed for Node.js directly in Deno.

In Deno v1.15, the development team released the first preview of "compat mode". Although the feature is still unstable, it can be enabled with the compat flag (most of the work involves providing polyfills in std/node).

Currently, some key modules such as tls and zlib are still incomplete, but can still run non-trivial type applications. The next goal, the team said, is to roll out the first iteration, suitable for all users, within the next few months.

Deno 2 route

In September 2021, the development team started discussing what Deno 2 will look like after its release. While there are still many obvious minor API changes to work out, the team is also investigating fundamental changes to improve Deno workflows.

The team said that it believes that the roadmap of Deno 2 will be released soon, and hopes to release it as soon as possible in the first half of this year. Deno 2 will focus on better NPM ecosystem compatibility, better Universal Workflow DX, and better exploration of alternative package management solutions.


MissD
955 声望40 粉丝