craft-plugins / benchmark
Simple benchmark plugin with basic benchmark functionality for Craft CMS.
Fund package maintenance!
awilum.github.io/donate
Requires
- craftcms/cms: ^4.3.3
Requires (Dev)
- ext-iconv: *
- pestphp/pest: ^1.21.1
- phpstan/phpstan: ^1.8.0
This package is auto-updated.
Last update: 2024-11-12 15:52:15 UTC
README
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
Tests
Run tests
./vendor/bin/pest
LICENSE
The MIT License (MIT) Copyright (c) Sergey Romanenko