Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Benchmark Laravel Package

dragon-code/benchmark

Lightweight PHP benchmarking helper to compare execution speed of multiple callbacks. Run named tests, repeat iterations, trim outliers for cleaner averages, and print results (min/max/avg/total + memory) to the console. Includes bench() helper and Benchmark class.

View on GitHub
Deep Wiki
Context7

Simple comparison of code execution speed between different options

Frequently asked questions about Benchmark
How do I install dragon-code/benchmark in a Laravel project?
Run `composer require dragon-code/benchmark --dev` in your project root. The package is development-only and won’t affect production builds. No Laravel-specific setup is required beyond installation.
Can I use this package in Laravel 8, 9, or 10?
Yes, the package supports PHP 8.0+, which aligns with Laravel 8+. No Laravel-specific dependencies exist, so it works across all supported Laravel versions without conflicts.
What’s the difference between the `bench()` helper and the `Benchmark` class?
Both provide identical functionality. Use `bench()` for concise syntax (e.g., `bench()->compare(...)`) or instantiate the `Benchmark` class directly (e.g., `new Benchmark()` or `Benchmark::make()`). Choose based on preference.
Does this package work in production, or is it dev-only?
This is a **development-only** tool. Avoid using it in production environments. It’s designed for local performance profiling and lacks production-grade validation (e.g., memory leak checks or race condition handling).
How accurate are the benchmark results for Laravel-specific code?
Results are accurate for isolated code comparisons but may vary in complex Laravel environments (e.g., with service container overhead, caching, or database interactions). Test in a staging-like setup for reliable insights.
What does the ‘top and bottom 10% exclusion’ feature do?
When running 9+ iterations, the package discards the slowest and fastest 10% of results to reduce noise from external factors (e.g., system load). This improves average accuracy for cleaner comparisons.
Are there alternatives like spatie/laravel-benchmark that integrate better with Laravel?
Yes, alternatives like `spatie/laravel-benchmark` offer Laravel-specific features (e.g., service container integration or database-aware benchmarks). However, `dragon-code/benchmark` is lighter and framework-agnostic if you need simplicity.
How do I benchmark Laravel route handlers or middleware?
Extract the logic into standalone closures or methods, then pass them to `bench()->compare()`. Avoid benchmarking full HTTP requests, as they include network overhead. For middleware, test individual handler logic separately.
Is this package actively maintained? Should I use it for critical performance tuning?
Maintenance is unclear—the last release (4.6.1) was in 2026 with no recent commits. Use it for exploratory testing, but validate results against other tools (e.g., Xdebug or Blackfire) for mission-critical decisions.
Can I extend or customize the benchmark output format?
The package provides a `toConsole()` method for tabular output, but customization requires extending the `Benchmark` class or forking the package. No built-in hooks exist for modifying output directly.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope