The importance of Signals over Change Detection and Zone.js

The importance of Signals over Change Detection and Zone.js

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

  • |

Lesson Transcript

  • [00:00 - 00:25] Now that we've understood the concepts of signals and why it's necessary for the angular ecosystem, let's now go a step further, by looking at the importance of signals over change detection and zone.js The first importance I want to look at is performance. With change detection, the default strategy of an angular application is to execute changes throughout the components or any major changes.

  • [00:26 - 00:37] So, as to ensure that the documents object model, also known as the DOM, displays the most recent updates. This strategy has a negative effect on the performance of an angular application.

  • [00:38 - 00:58] In comparison, making use of signals, we're able to detect where changes occur precisely in the components tree and reflect those changes without re-rendering the entire component tree. Another important thing about signals over zone.js as well as change detection is the bundle size.

  • [00:59 - 01:20] With change detection, which utilizes the library called zone.js, the library automatically increases the overall bundle size of the angular application. In comparison to this, making use of signals, we are able to build a zone-less application which is much more lightweight without the need to make use of zone.js library.

  • [01:21 - 01:39] The final importance I want to make mention of is productivity. Over time, the productivity of developers working on large applications will start to dwindle at some point as the application continues to grow due to the zone.js library which needs to reload the application from the component root.

  • [01:40 - 01:59] The time begins to refresh the entire application on over time and leads to reduce productivity. In comparison to this, with signals which provides a new way of detecting changes in data and makes do without the zone.js library, productivity will automatically increase.

  • [02:00 - 02:12] I think with these few points, we can see the major importance of signals over zone.js as well as change detection. And with this, you can now move on to the next lesson of this module.