diff --git a/scripts/bench/one.php b/scripts/bench/one.php index 7dd08bd..76e973c 100644 --- a/scripts/bench/one.php +++ b/scripts/bench/one.php @@ -16,6 +16,12 @@ exit(2); } +// Untimed setup a scenario may need, such as writing its fixtures. +$prepare = "bench_prepare_{$scenario}"; +if (function_exists($prepare)) { + $prepare(); +} + $start = hrtime(true); $bytes = $fn(); $ms = (hrtime(true) - $start) / 1e6; diff --git a/scripts/bench/run.php b/scripts/bench/run.php index 84bc393..2380362 100644 --- a/scripts/bench/run.php +++ b/scripts/bench/run.php @@ -28,6 +28,7 @@ 'invoice' => ['label' => '100-page invoice (50 rows/page)'], 'images' => ['label' => 'Image grid (20 pages × 4 JPEGs)'], 'html' => ['label' => 'HTML → PDF article (~5 pages)'], + 'svg' => ['label' => 'SVG dashboards (10 pages, ~1,200 shapes each)'], ]; $libs = ['phppdf', 'mpdf', 'tcpdf', 'dompdf', 'fpdf']; @@ -244,7 +245,7 @@ function summary_table(array $scenarios, array $results): string { $out = "| Scenario | dskripchenko/php-pdf | mpdf | tcpdf | dompdf | FPDF |\n"; $out .= "|---|---:|---:|---:|---:|---:|\n"; - foreach (['html', 'invoice', 'images', 'hello'] as $key) { + foreach (['html', 'invoice', 'images', 'svg', 'hello'] as $key) { if (! isset($scenarios[$key])) { continue; } @@ -322,9 +323,10 @@ function emit_benchmarks_doc(array $scenarios, array $results, array $meta): str | `invoice` | 100 pages × 50 rows; each page has an `