Simple benchmark plugin with basic functionality for benchmarking.
Requirements
- Craft CMS: ^4.0
- PHP: ^8.0
Installation
To install the plugin, follow these instructions.
Open your terminal and go to your Craft project:
cd /path/to/project
In your terminal run
composer require awilum/craft-benchmark
.In the Control Panel, go to Settings → Plugins and click the “Install” button for Benchmark.
Usage
{% do benchmarkStart('fetch_news') %}
{% set entryQuery = craft.entries()
.section('news')
.orderBy('postDate DESC')
.limit(10) %}
{% do benchmarkEnd('fetch_news') %}
Time elapsed: {{ benchmarkSummary()['fetch_news']['time']['elapsed_formated'] }}
Memory usage: {{ benchmarkSummary()['fetch_news']['memory']['usage_formated'] }}
//=> Time elapsed: 1ms
//=> Memory usage: 3.46KB
Functions
PHP function | Twig function | Description |
Awilum\CraftBenchmark\benchmarkStart |
benchmarkStart | Start benchmark prob. |
Awilum\CraftBenchmark\benchmarkEnd |
benchmarkEnd | End benchmark prob. |
Awilum\CraftBenchmark\benchmarkDelete |
benchmarkDelete | Delete benchmark prob. |
Awilum\CraftBenchmark\benchmarkFlush |
benchmarkFlush | Flush benchmark prob. |
Awilum\CraftBenchmark\benchmarkSummary |
benchmarkSummary | Get benchmark summary. |
Installation Instructions
To install this plugin, copy the command above to your terminal.
Reviews
This plugin doesn't have any reviews.
Active Installs
1
License
MIT
Last release
December 12, 2022
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs