Slender Core Team Mulls Rust Compile to Further Speed ​​Up Web Applications – The New Stack


The next major release of Svelte, the increasingly popular web application framework, could benefit from improved performance and security for the Rust programming language, according to its creator. Rich Harris.

Among the possible changes for the eventual release of Svelte 4.0 is a new compiler, written in Rust, Harris said in a video interview produced by web development tools provider Vercel, where Harris is currently employed.

“A lot of JavaScript programming is currently written in Rust, and it might make sense for the Svelte compiler to be written in Rust,” Harris said. He stopped before fully committing to moving to Rust in this next release, while indicating that this was a promising approach that the core dev team was exploring.

Currently, Svelte works by compiling web application code (built from HTML, CSS, and JavaScript) into highly optimized JavaScript. It differs from popular JavaScript frameworks like React.JS and Vue which render complex web pages at run time in the browser. It eliminates this tedious step by moving most of the rendering work out of the browser, compiling the application in advance.

Despite Svelte’s potential performance improvements, Harris has heard complaints about very large code sizes resulting from very large web applications. Svelte compiles code for large web apps, for example, tends to be larger than component code for a similar app rendered in React. “It’s something that people are concerned about,” Harris said.

A Rust-based approach to complicating code could potentially “not only eliminate this problem, it could actually mean that the compiled code is smaller than the input code, which I think would be quite unique,” he said. Harris said. (Harris didn’t specify how the browser would interpret Rust code, although WebAssembly can provide an efficient delivery mechanism.)

Although a bit difficult to learn, the Rust language is quickly adopted by system designers, not only for its fast performance, but also for its security checks. To that end, Harris noted that a move to Rust “potentially opens the door to the limits of error.”

Catching up with React

The core team is also researching a number of other potential improvements, including the integration of React server components and the incorporation of “partial hydration approaches. “

Harris also wants to continue exploring Svelte’s medium for rendering movement. “It’s something Svelte has always prioritized,” Harris boasted. Svelte has declarative transitions to make it easier to add or remove an item from the browser’s Document Object Model (DOM). “We will not be removing the item from the DOM immediately. We can play a transition in it so that you get a graceful sliding, exiting, entering and exiting behavior, ”he said.

Despite these advanced features, Harris envies React’s Framer Motion library for producing animated layouts. “I think if a framework treated these things as its domain, then you could do a really nice UI design with very minimal effort,” he said.

The current version of Svelte (v3) was released in April 2019, and new versions are arriving every year and a half or so. The release date for Svelte 4.0 has yet to be publicly set.

Find the full interview here:


About Author

Comments are closed.