You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default Blaze uses **Function Compilation**, which works for virtually all components and provides significant performance improvements — this is sufficient for most use cases.
137
137
@@ -144,7 +144,7 @@ To go even further, you can consider the other strategies that require additiona
144
144
| Compile-Time Folding |`fold`| Maximum performance | 100% |
145
145
146
146
147
-
##Function Compilation
147
+
# Function Compilation
148
148
149
149
This strategy transforms your components into optimized PHP functions, bypassing the entire component rendering pipeline while maintaining identical behavior to standard Blade.
150
150
@@ -164,7 +164,7 @@ The following benchmarks represent 25,000 components rendered in a loop:
164
164
165
165
> These numbers reflect rendering pipeline overhead. If your components execute expensive operations internally, that work will still affect performance when using this strategy.
166
166
167
-
###How It Works
167
+
## How It Works
168
168
169
169
When you enable Blaze, components are compiled into direct function calls:
Runtime memoization caches component output during a single request. When a component renders with the same props multiple times, it only executes once. This strategy is ideal for components like icons and avatars that appear many times with identical values:
206
206
@@ -223,11 +223,11 @@ Because there might be multiple tasks with the same status, we don't need to re-
223
223
> [!NOTE]
224
224
> Memoization only works for components without slots.
225
225
226
-
##Compile-Time Folding
226
+
# Compile-Time Folding
227
227
228
228
Compile-time folding is Blaze's most aggressive optimization. It pre-renders components during compilation, embedding the HTML directly into your template. The component ceases to exist at runtime - there is no function call, no variable resolution, no overhead whatsoever.
229
229
230
-
###Benchmark Results
230
+
## Benchmark Results
231
231
232
232
Because folded components are rendered at compile-time, the runtime cost is effectively zero. The rendering time remains constant regardless of how many components you use:
233
233
@@ -453,7 +453,7 @@ For more precision, target specific attributes:
453
453
454
454
Now `<x-alert :variant="$type">` aborts folding, but `<x-alert :class="$classes">` still folds.
455
455
456
-
###Global State
456
+
## Global State
457
457
458
458
Folded components are rendered at compile-time. Any global state is captured at compilation, not runtime:
459
459
@@ -480,7 +480,7 @@ If a logged-in user triggers compilation, the "Welcome" message gets permanently
480
480
| Time |`now()`, `Carbon::now()`|
481
481
| Security |`@csrf`|
482
482
483
-
###The Unblaze Directive
483
+
## The Unblaze Directive
484
484
485
485
When a component is mostly foldable but needs a dynamic section, use `@unblaze` to exclude that section:
486
486
@@ -505,7 +505,7 @@ The label and input are folded. Error handling remains dynamic.
505
505
506
506
Variables from the component scope must be passed explicitly using the `scope` parameter.
0 commit comments