Commit 5bc9a5d
committed
perf: render template in a single pass
Replace the per-variable loop (each iteration building a fresh RegExp
and scanning the full template) with one pass over TOKEN_REGEX that
substitutes every token inline. Fewer allocations and O(n) in template
length instead of O(n * number of variables). Unknown tokens are left
untouched, matching the previous behavior.1 parent 2d646c1 commit 5bc9a5d
1 file changed
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 1 | + | |
9 | 2 | | |
10 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
11 | 7 | | |
0 commit comments