Skip to content

Commit 9bac552

Browse files
authored
[Blazor] Performance - Parameter values bundling vs. change detection (#34291)
1 parent a19f35a commit 9bac552

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

aspnetcore/blazor/performance.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ To reduce parameter load, bundle multiple parameters in a custom class. For exam
228228
}
229229
```
230230

231-
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).
231+
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.
232+
233+
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).
232234

233235
> [!NOTE]
234236
> When multiple approaches are available for improving performance, benchmarking the approaches is usually required to determine which approach yields the best results.

0 commit comments

Comments
 (0)