mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-09-01 13:08:14 +00:00
:octocat: decrease versions to benchmark
This commit is contained in:
@@ -122,10 +122,13 @@ abstract class BenchmarkAbstract{
|
||||
}
|
||||
|
||||
public function versionProvider():Generator{
|
||||
for($v = 1; $v <= 40; $v++){
|
||||
$version = new Version($v);
|
||||
|
||||
yield (string)$version => ['version' => $version];
|
||||
// run all versions between 1 and 10 as they're the most commonly used
|
||||
for($v = 1; $v <= 10; $v++){
|
||||
yield (string)$v => ['version' => new Version($v)];
|
||||
}
|
||||
// 15-40 in steps of 5
|
||||
for($v = 15; $v <= 40; $v += 5){
|
||||
yield (string)$v => ['version' => new Version($v)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace chillerlan\QRCodeBenchmark;
|
||||
|
||||
use chillerlan\QRCode\Common\{MaskPattern, Mode};
|
||||
use chillerlan\QRCode\Common\{MaskPattern, Mode, Version};
|
||||
use chillerlan\QRCode\Data\Byte;
|
||||
use PhpBench\Attributes\{BeforeMethods, Subject};
|
||||
use Generator;
|
||||
use function range;
|
||||
|
||||
/**
|
||||
* Tests the performance of the mask pattern penalty testing
|
||||
@@ -22,6 +24,12 @@ final class MaskPatternBenchmark extends BenchmarkAbstract{
|
||||
|
||||
protected const DATAMODES = [Mode::BYTE => Byte::class];
|
||||
|
||||
public function versionProvider():Generator{
|
||||
for($v = 1; $v <= 40; $v++){
|
||||
yield (string)$v => ['version' => new Version($v)];
|
||||
}
|
||||
}
|
||||
|
||||
public function initOptions():void{
|
||||
|
||||
$options = [
|
||||
|
||||
@@ -11,10 +11,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace chillerlan\QRCodeBenchmark;
|
||||
|
||||
use chillerlan\QRCode\Common\{EccLevel, Mode};
|
||||
use chillerlan\QRCode\Common\Mode;
|
||||
use chillerlan\QRCode\Data\Byte;
|
||||
use chillerlan\QRCode\Output\{
|
||||
QREps, QRFpdf, QRGdImageJPEG, QRGdImagePNG, QRGdImageWEBP, QRImagick, QRMarkupSVG, QRStringJSON
|
||||
QREps, QRFpdf, QRGdImageAVIF, QRGdImageJPEG, QRGdImagePNG, QRGdImageWEBP, QRImagick, QRMarkupSVG, QRStringJSON
|
||||
};
|
||||
use PhpBench\Attributes\{BeforeMethods, Subject};
|
||||
|
||||
@@ -24,8 +24,7 @@ use PhpBench\Attributes\{BeforeMethods, Subject};
|
||||
#[BeforeMethods(['assignParams', 'generateTestData', 'initOptions', 'initMatrix'])]
|
||||
final class OutputBenchmark extends BenchmarkAbstract{
|
||||
|
||||
protected const ECC_LEVELS = [EccLevel::H];
|
||||
protected const DATAMODES = [Mode::BYTE => Byte::class];
|
||||
protected const DATAMODES = [Mode::BYTE => Byte::class];
|
||||
|
||||
public function initOptions():void{
|
||||
|
||||
@@ -54,10 +53,10 @@ final class OutputBenchmark extends BenchmarkAbstract{
|
||||
/**
|
||||
* for some reason imageavif() is extremely slow, ~50x slower than imagepng()
|
||||
*/
|
||||
# #[Subject]
|
||||
# public function QRGdImageAVIF():void{
|
||||
# (new QRGdImageAVIF($this->options, $this->matrix))->dump();
|
||||
# }
|
||||
#[Subject]
|
||||
public function QRGdImageAVIF():void{
|
||||
(new QRGdImageAVIF($this->options, $this->matrix))->dump();
|
||||
}
|
||||
|
||||
#[Subject]
|
||||
public function QRGdImageJPEG():void{
|
||||
|
||||
@@ -18,6 +18,7 @@ use function array_keys;
|
||||
use function file_exists;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function htmlspecialchars;
|
||||
use function implode;
|
||||
use function is_bool;
|
||||
use function is_dir;
|
||||
@@ -46,7 +47,7 @@ $markdown['Readme'][] = '| Name | Value |';
|
||||
$markdown['Readme'][] = '|------|-------|';
|
||||
$markdown['Readme'][] = sprintf('| date | %s %s |', $suite['date'], $suite['time']);
|
||||
$markdown['Readme'][] = sprintf('| environment | %s %s, %s |', $env['uname_os'], $env['uname_version'], $env['uname_machine']);
|
||||
$markdown['Readme'][] = sprintf('| tag | %s |', $suite['tag']);
|
||||
$markdown['Readme'][] = sprintf('| tag | %s |', htmlspecialchars($suite['tag']));
|
||||
|
||||
|
||||
foreach(['php_version', 'php_ini', 'php_extensions', 'php_xdebug', 'opcache_extension_loaded', 'opcache_enabled'] as $field){
|
||||
|
||||
Reference in New Issue
Block a user