A
A
Andrew2020-11-26 18:57:45
Angular
Andrew, 2020-11-26 18:57:45

Component decomposition and performance in Angular: is there a connection?

It's about Angular 2+.

Is there a performance difference between one large component and the same component but broken down to us small child components?

For example, there is an order editor. It has a list of services and goods (where each service and product is a composite element with different options), a list of employees fulfilling an order, a set of data about an order, a client, etc.

Will there be a difference in performance (interface response time) - is it one component with many elements, or is it one component with many child components, which in turn can be broken down into even smaller components?

There is no advice on splitting in any "list of performance recommendations", but in theory, reducing components should reduce the cost of one change, or not?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2020-11-26
@byte916

On each asynchronous event, Angular performs change detection over the entire component tree. Although the code which detects for changes is optimized for inline-caching, this still can be a heavy computation in complex applications. A way to improve the performance of the change detection is to not perform it for subtrees which are not supposed to be changed based on the recent actions.

does this count as an answer to your question?
from here https://github.com/mgechev/angular-performance-che...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question