Vue.JS 3 Improves Performance |
Written by Kay Ewbank |
Monday, 21 September 2020 |
There's a major new release of Vue.js, the JavaScript library. The developers say version 3 provides improved performance, smaller bundle sizes, better TypeScript integration, new APIs for tackling large scale use cases, and "a solid foundation for long-term future iterations of the framework". Vue.js is a small, flexible JavaScript library that you can use to build interactive web applications. The developers say it offers simplicity, performance, and flexibility. It is made up of a core view layer, developer tools and libraries. The first change has been implemented to improve maintainability, and as a side effect means users can minimize the size of their runtime by being choosy about which modules they include. The key to this is that while Vue 3.0 core can still be used via a simple script tag, its internals has been re-written from the ground up into a collection of decoupled modules. The performance of Vue.js 3 has also been improved.The initial render happens up to 55% faster, updates are up to 133% faster, and memory usage has been lowered to up to 54% less. The developers have also worker on the template compiler to improve performance via what they describe as "compiler-informed Virtual DOM": The template compiler performs aggressive optimizations and generates render function code that flattens the dynamic nodes inside a template to improve runtime traversal. The render function code also leaves runtime hints for binding types. The Vue.js team says the improvements mean user get the best of both worlds: compiler-optimized performance from templates, or direct control via manual render functions when necessary. While the object-based API from version 2 remains largely intact in Vue 3, there's a new set of APIs collected in the new Composition API. The new APIs are designed to make it easier to use Vue in large scale applications. The Composition API builds on top of the reactivity API and enables logic composition and reuse similar to React hooks, more flexible code organization patterns, and more reliable type inference than the 2.x Object-based API. The final main improvement is improved TypeScript integration. Vue 3's codebase is written in TypeScript, with automatically generated, tested, and bundled type definitions so they are always up-to-date. The new Composition API is designed to work well with type inference, and Vetur, the Vue.js VSCode extension, now supports template expression and props type checking making use of Vue 3's improved internal typing. More InformationRelated ArticlesJavaScript For Native Apps
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |