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

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-actionsBot 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.

BenchmarkBase ops/sPR ops/sDelta ops/sRSD (base / PR)Delta memoryMemory %
ThemeBench::benchParse342.55 ops/s342.21 ops/s-0.10%3.05% / 2.54%-306.50 KiB-3.43%
ThemeBench::benchRender233.17 ops/s281.07 ops/s+20.54%1.24% / 2.30%+106.16 KiB+1.19%
ThemeBench::benchStream234.15 ops/s231.85 ops/s-0.98%2.22% / 2.23%+302.81 KiB+3.85%
ThemeBench::benchTokenize1,090.73 ops/s1,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-actionsBot 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.

BenchmarkBase ops/sPR ops/sDelta ops/sRSD (base / PR)Delta memoryMemory %
ThemeBench::benchParse549.51 ops/s556.01 ops/s+1.18%0.84% / 1.74%-176.00 B-0.00%
ThemeBench::benchRender332.86 ops/s411.46 ops/s+23.62%1.92% / 1.58%-1.73 KiB-0.02%
ThemeBench::benchStream331.50 ops/s339.73 ops/s+2.48%1.51% / 1.42%+124.18 KiB+1.56%
ThemeBench::benchTokenize1,233.84 ops/s1,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-actionsBot 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.

BenchmarkBase ops/sPR ops/sDelta ops/sRSD (base / PR)Delta memoryMemory %
ThemeBench::benchParse525.44 ops/s524.15 ops/s-0.24%1.22% / 0.77%-176.00 B-0.00%
ThemeBench::benchRender310.02 ops/s399.61 ops/s+28.90%1.76% / 1.57%-1.73 KiB-0.02%
ThemeBench::benchStream308.40 ops/s329.40 ops/s+6.81%1.87% / 1.24%+124.31 KiB+1.58%
ThemeBench::benchTokenize1,101.56 ops/s1,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-actionsBot 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.

BenchmarkBase ops/sPR ops/sDelta ops/sRSD (base / PR)Delta memoryMemory %
ThemeBench::benchParse299.95 ops/s306.22 ops/s+2.09%2.22% / 2.24%+306.16 KiB+3.50%
ThemeBench::benchRender193.95 ops/s234.02 ops/s+20.66%2.12% / 2.38%+68.39 KiB+0.77%
ThemeBench::benchStream196.89 ops/s201.66 ops/s+2.42%1.39% / 1.47%+23.97 KiB+0.30%
ThemeBench::benchTokenize877.76 ops/s879.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

- 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 mainAug 4, 2026
14 checks passed
Sign up for freeto 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

@cappuc