Skip to content

Add benchmarks#294

Merged
samdark merged 8 commits into
masterfrom
benchmarks
Jan 6, 2026
Merged

Add benchmarks#294
samdark merged 8 commits into
masterfrom
benchmarks

Conversation

@samdark

@samdark samdark commented Jan 6, 2026

Copy link
Copy Markdown
Member
Q A
Is bugfix?
New feature?
Breaks BC?
Fixed issues -

Copilot AI review requested due to automatic review settings January 6, 2026 20:34
Comment thread .github/workflows/benchmark.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive performance benchmarking infrastructure to the project using PHPBench. It introduces 8 benchmark classes covering various rendering scenarios, configuration files, documentation, and CI workflow integration.

Key Changes:

  • Added 8 benchmark classes for testing different view rendering scenarios (basic views, nested views, themes, locales, assets, blocks, and multiple renderers)
  • Configured PHPBench with phpbench.json and added composer script for running benchmarks
  • Added GitHub Actions workflow for automated benchmark execution on pull requests and pushes

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Benchmark/WebViewBench.php Benchmark for WebView layout rendering
tests/Benchmark/WebViewAssetsBench.php Benchmark for WebView with asset registration (CSS/JS files and strings)
tests/Benchmark/ViewThemeBench.php Benchmark for themed view rendering
tests/Benchmark/ViewLocaleBench.php Benchmark for localized view rendering
tests/Benchmark/ViewBasicBench.php Benchmark for simple view rendering without additional features
tests/Benchmark/NestedViewsBench.php Benchmark for nested view rendering scenarios
tests/Benchmark/MultiRendererBench.php Benchmark for multiple template renderers (PHP, Blade, TPL)
tests/Benchmark/BlocksBench.php Benchmark for view blocks functionality
phpbench.json PHPBench configuration with 1000 revisions and 10 iterations
composer.json Added phpbench dependency and bench script
.github/workflows/benchmark.yml CI workflow for running benchmarks on Ubuntu and Windows with PHP 8.1
docs/internals.md Documentation for running benchmarks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Benchmark/WebViewAssetsBench.php Outdated
Comment on lines +22 to +23
#[Bench\BeforeMethods(['prepareView'])]
public function prepareView(): void

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BeforeMethods attribute references 'prepareView' which is the same method being annotated. This creates a recursive call that will cause an infinite loop. The attribute should either be removed or reference a different setup method.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +21
$this->preparedView = $this->view;
}

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property 'preparedView' is declared as non-readonly but is initialized with a readonly property 'view' in the constructor. This assignment doesn't provide any value since both properties reference the same instance at construction time. Consider removing line 19 or initializing 'preparedView' differently if it's meant to be modified later.

Suggested change
$this->preparedView = $this->view;
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +34
<?php

declare(strict_types=1);

/** @var \Yiisoft\View\View $this */

echo 'PHP view';
PHP_WRAP

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The heredoc content has inconsistent leading whitespace. Lines 28-33 have excessive leading spaces that will be included in the file content, which may not be intended.

Suggested change
<?php
declare(strict_types=1);
/** @var \Yiisoft\View\View $this */
echo 'PHP view';
PHP_WRAP
<?php
declare(strict_types=1);
/** @var \Yiisoft\View\View $this */
echo 'PHP view';
PHP_WRAP

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Jan 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.50%. Comparing base (d75c571) to head (7fae7fd).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #294   +/-   ##
=========================================
  Coverage     99.50%   99.50%           
  Complexity      305      305           
=========================================
  Files            19       19           
  Lines           801      801           
=========================================
  Hits            797      797           
  Misses            4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samdark samdark merged commit 7ed8d9c into master Jan 6, 2026
24 of 25 checks passed
@samdark samdark deleted the benchmarks branch January 6, 2026 21:01
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.

4 participants