Why Is Angular 2 So Slow In Development Mode

Why Is Angular 2 So Slow In Development Mode

Welcome to the world of Angular development! Angular is a very popular and widely used framework among many developers. Angular technology provides specialists with a set of tools for fast and high-quality development of web applications and at the same time automatically sets the application design and code organization. Every newbie in development, before studying this technology, reads dozens of articles from Google about the capabilities of Angular, its advantages. But when using Angular in the development process, some difficulties arise that significantly slow down this process. In this article, which is called ‘Why Is Angular 2 So Slow In Development Mode’, we will look at the reasons for the slow operation of Angular during the development process. Let’s start from the beginning!

The world of web development says that Angular is a very fast framework with huge capabilities. This technology gives developers a lot of opportunities to improve performance through fine tuning. It’s true that programmers almost never need to do anything special in order to create extremely productive code when working on simple applications. But it turns out that there are some special cases where performance issues in Angular 2 applications can still arise. For example, a slow development mode in Angular 2 happens in the case of applications that need to be extremely productive to use. Also, when developing applications with large amounts of complex content and in applications whose content is updated very often. Developers usually analyze the performance of functions and try to find the reasons for this slowness in the development process. For example, they are interested in how long it will take to find an element (or a pair of elements), or how long Angular 2 will take to sort them. But in the development of a typical application, these optimizations can mean much less than they might seem at first glance. I do not want to say that such things are not important at all, but I would start looking for the causes of application performance problems by asking how much information the application can hold and display during development and how often the framework re-renders components.

Now, let’s move on to a more detailed consideration of the reasons for slow development mode.

Why Is Angular 2 So Slow In Development Mode

1) The first reason is too frequent rendering of components. That is, rendering is generally necessary during development, but when the application unnecessarily re-renders the components, it makes the project slower than it could be. This problem is solved by configuring the components so that they are updated only when a real need arises, you can prevent the components from re-rendering in cases where the data output by them has not changed. This is a clear change-handling strategy that is greatly simplified by using observables and asynchronous pipes.

2) Another reason for the slow development mode is the very frequent page updates. Angular 2 does not handle frequent page updates very well. This is probably due to the Zone.js library, which also underlies Angular’s automatic change detection mechanism. Of course, you don’t need to remove Zone.js from your application to solve this problem. But there are also several other ways to solve this: disable components that are updated too often, then, when you receive notifications from subscriptions, update them, paying attention to every detail; use ngZone.runOutsideAngular (callback) to call a callback outside of Angular’s change detection system; exclude events from those for which Zone.js creates monkey patches.

3) The third reason is also related to rendering, namely, too many components are being rendered. Regardless of how fast your framework is, if you render thousands of complex components in one go, you will find yourself in a situation where the browser starts to “slow down”. It is very important to build the application in such a way that even components that display many elements (for example, list components) are optimized in a certain way. This can be achieved in the following ways: using keys is the simplest and perhaps the most famous technique for speeding up the rendering of lists, which is used in most libraries; virtual scrolling means rendering only what the user sees; asynchronous rendering, which is better than rendering thousands of items at the same time; lazy rendering and event listeners.

4) Sometimes the problem is not caused by the framework used, but by flaws in the code or architecture of the project. This means that your code itself can be quite slow. Perhaps this is due to some heavy computation and has nothing to do with the DOM at all. For these reasons, there are modern solutions in the world of web development. For example, you can use web workers. Everything is very simple in such a method: it is worth using web workers when the code does not interact with the DOM, and when it takes some time to execute.

Usually in such code some calculations, data processing and so on are performed. If you don’t like this idea, or they simply cannot solve your problem, it means that the time has come for micro-optimizations and analysis of how they can improve system performance: implement your own IterableDiffer; to reduce the number of iterations, use break and continue; make sure that your objects have the correct shape.


Angular has established itself in the world of web development as a leader with huge opportunities and advantages, but like any technology, it can slow down the entire development process and the overall performance of your project. Angular 2 does not carry out a deep comparative analysis of objects, and if an element is added to the data array, the path change will not be detected. This also applies to object properties as long as they are not directly related to the View. But this characteristic of Angular 2 excellent performance is slowing down due to three probable reasons that have been written above. Sometimes it happens that your code itself can be quite slow and the reason is not at all about rendering many components and updating them. Then there are a couple of modern solutions to these problems and related to speeding up Angular applications. Thanks for reading an article ‘Why Is Angular 2 So Slow In Development Mode’. I hope that the received information will be useful to you, and the article has given answers to all questions about slow development mode. Good luck!

Leave a Reply

Scroll to Top