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.
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.
Sign up for Computerworld eNewsletters.