Vue.js lead: Our JavaScript framework is faster than React

02.05.2016
To take on Facebook's vaunted React JavaScript library, the Vue.js front-end framework has been upgraded with a virtual DOM layer improving speed and memory consumption.

Version 2.0 of Vue.js, recently released as a public preview, is leaner and faster than before, according to a bulletin on the technology. "The rendering layer is now based on a lightweight virtual-DOM implementation that improves initial rendering speed and memory consumption by up to 2-4x in most scenarios."

Mainstream virtual DOM implementations suffer from performance issues like re-rendering, requiring optimizations, Vue principal developer Evan You said. "Vue 2.0 tackles this problem by combining virtual DOM with its reactive dependency tracking system, so that the system can automatically and efficiently determine when and what to re-render, freeing the developer from unnecessary optimization work," he said. Version 1.0.0 of Vue.js was released in late-October.

The upgrade offers both template-based syntax and programmatic rendering with JSX or hyperscript, so developers get maximum flexibility in terms of development style, said You. "Performance-wise, it offers faster rendering than React with minimal optimization efforts. It also offers server-side rendering, a feature deemed the holy grail of universal JavaScript applications."

Vue 2.0's built-in streaming server-side rendering enables rendering of components while getting a readable stream back and directly piping it to the HTTP response. You stressed Vue 2.0 also provides a light footprint and a "forgiving" learning curve.

Featuring its core view layer, tools, and libraries, the framework's template-to-virtual-DOM compiler and runtime can be separated; developers can precompile templates and ship applications with only the runtime. "The compiler also works in the browser, which means you can still drop in one script tag and start hacking, just like before," said You. "Even with the compiler included, the build is sitting at 17kb min+gzip, still lighter than the current 1.0 build."

Source code for Vue 2.0 is available on GitHub, with a beta release eyed for May. The documentation warns that developers will have some work to do to migrate an existing app from Vue 1.0 if they use deprecated features. Detailed upgrade guides are planned for the near future.

(www.infoworld.com)

Paul Krill

Zur Startseite