[Blazor] Performance - Parameter values bundling vs. change detection (#34291)
parent
a19f35a4af
commit
9bac552349
|
@ -228,7 +228,9 @@ To reduce parameter load, bundle multiple parameters in a custom class. For exam
|
|||
}
|
||||
```
|
||||
|
||||
However, consider that it might be an improvement not to have a table cell component, as shown in the preceding example, and instead [inline its logic into the parent component](#inline-child-components-into-their-parents).
|
||||
However, keep in mind that bundling primitive parameters into a class isn't always an advantage. While it can reduce parameter count, it also impacts how change detection and rendering behave. Passing non-primitive parameters always triggers a re-render, because Blazor can't know whether arbitrary objects have internally mutable state, whereas passing primitive parameters only triggers a re-render if their values have actually changed.
|
||||
|
||||
Also, consider that it might be an improvement not to have a table cell component, as shown in the preceding example, and instead [inline its logic into the parent component](#inline-child-components-into-their-parents).
|
||||
|
||||
> [!NOTE]
|
||||
> When multiple approaches are available for improving performance, benchmarking the approaches is usually required to determine which approach yields the best results.
|
||||
|
|
Loading…
Reference in New Issue