Skip to content

Stream control-flow tags and optimize render context - #74

Merged
cappuc merged 11 commits into
mainfrom
feat/perf-improvements
Aug 4, 2026
Merged

Stream control-flow tags and optimize render context#74
cappuc merged 11 commits into
mainfrom
feat/perf-improvements

Conversation

@cappuc

@cappuc cappuc commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Stream for, if, unless, and case tag bodies incrementally.
  • Preserve loop break/continue behavior and normalize iterable handling.
  • Reuse shared render context state and optimize common array assignments.
  • Update the streaming benchmark drain logic.

Testing

  • Added integration coverage for streamed control-flow tags and loop interruptions.
  • Not run.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PHPBench comparison (PHP 8.4)

PHP 8.4 | Runner ubuntu24 | Base 3200449 | PR 3c04b6f | 10 iterations x 20 revs | 1 warmup

Positive ops/s is faster. RSD above 5% is marked high.

Benchmark Base ops/s PR ops/s Delta ops/s RSD (base / PR) Delta memory Memory %
ThemeBench::benchParse 342.55 ops/s 342.21 ops/s -0.10% 3.05% / 2.54% -306.50 KiB -3.43%
ThemeBench::benchRender 233.17 ops/s 281.07 ops/s +20.54% 1.24% / 2.30% +106.16 KiB +1.19%
ThemeBench::benchStream 234.15 ops/s 231.85 ops/s -0.98% 2.22% / 2.23% +302.81 KiB +3.85%
ThemeBench::benchTokenize 1,090.73 ops/s 1,116.78 ops/s +2.39% 1.62% / 2.94% -176.00 B -0.00%
  • Improved (> +2%): 2 (median +11.46%)

  • Neutral (within ±2%): 2

  • Regressed (< -2%): 0

  • Worst throughput regression: n/a

  • Total memory change: +0.31%

  • Regression threshold (PHPBENCH_MAX_REG): 5.00%

  • Threshold status: PASSED

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PHPBench comparison (PHP 8.3)

PHP 8.3 | Runner ubuntu24 | Base 3200449 | PR 3c04b6f | 10 iterations x 20 revs | 1 warmup

Positive ops/s is faster. RSD above 5% is marked high.

Benchmark Base ops/s PR ops/s Delta ops/s RSD (base / PR) Delta memory Memory %
ThemeBench::benchParse 549.51 ops/s 556.01 ops/s +1.18% 0.84% / 1.74% -176.00 B -0.00%
ThemeBench::benchRender 332.86 ops/s 411.46 ops/s +23.62% 1.92% / 1.58% -1.73 KiB -0.02%
ThemeBench::benchStream 331.50 ops/s 339.73 ops/s +2.48% 1.51% / 1.42% +124.18 KiB +1.56%
ThemeBench::benchTokenize 1,233.84 ops/s 1,255.04 ops/s +1.72% 0.71% / 1.36% -176.00 B -0.00%
  • Improved (> +2%): 2 (median +13.05%)

  • Neutral (within ±2%): 2

  • Regressed (< -2%): 0

  • Worst throughput regression: n/a

  • Total memory change: +0.37%

  • Regression threshold (PHPBENCH_MAX_REG): 5.00%

  • Threshold status: PASSED

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PHPBench comparison (PHP 8.2)

PHP 8.2 | Runner ubuntu24 | Base 3200449 | PR 3c04b6f | 10 iterations x 20 revs | 1 warmup

Positive ops/s is faster. RSD above 5% is marked high.

Benchmark Base ops/s PR ops/s Delta ops/s RSD (base / PR) Delta memory Memory %
ThemeBench::benchParse 525.44 ops/s 524.15 ops/s -0.24% 1.22% / 0.77% -176.00 B -0.00%
ThemeBench::benchRender 310.02 ops/s 399.61 ops/s +28.90% 1.76% / 1.57% -1.73 KiB -0.02%
ThemeBench::benchStream 308.40 ops/s 329.40 ops/s +6.81% 1.87% / 1.24% +124.31 KiB +1.58%
ThemeBench::benchTokenize 1,101.56 ops/s 1,100.97 ops/s -0.05% 1.26% / 1.12% -176.00 B -0.00%
  • Improved (> +2%): 2 (median +17.85%)

  • Neutral (within ±2%): 2

  • Regressed (< -2%): 0

  • Worst throughput regression: n/a

  • Total memory change: +0.38%

  • Regression threshold (PHPBENCH_MAX_REG): 5.00%

  • Threshold status: PASSED

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PHPBench comparison (PHP 8.5)

PHP 8.5 | Runner ubuntu24 | Base 3200449 | PR 3c04b6f | 10 iterations x 20 revs | 1 warmup

Positive ops/s is faster. RSD above 5% is marked high.

Benchmark Base ops/s PR ops/s Delta ops/s RSD (base / PR) Delta memory Memory %
ThemeBench::benchParse 299.95 ops/s 306.22 ops/s +2.09% 2.22% / 2.24% +306.16 KiB +3.50%
ThemeBench::benchRender 193.95 ops/s 234.02 ops/s +20.66% 2.12% / 2.38% +68.39 KiB +0.77%
ThemeBench::benchStream 196.89 ops/s 201.66 ops/s +2.42% 1.39% / 1.47% +23.97 KiB +0.30%
ThemeBench::benchTokenize 877.76 ops/s 879.49 ops/s +0.20% 2.46% / 2.05% -176.00 B -0.00%
  • Improved (> +2%): 3 (median +2.42%)

  • Neutral (within ±2%): 1

  • Regressed (< -2%): 0

  • Worst throughput regression: n/a

  • Total memory change: +1.20%

  • Regression threshold (PHPBENCH_MAX_REG): 5.00%

  • Threshold status: PASSED

cappuc added 6 commits August 4, 2026 11:23
- Track streamed output across chunks and reset per root stream
- Charge captured values to the assign score
- Cover partials, custom nodes, and zero-valued limits
- Flush buffered output before rethrowing errors
- Preserve streaming behavior with threshold coverage
- Move chunk buffering into BodyNode streaming
- Preserve template-level resource-limit accounting
@cappuc
cappuc merged commit f91f238 into main Aug 4, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant