feat(benchmark): add lifecycle hooks for enhanced benchmark control #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Lifecycle Hooks
This PR introduces lifecycle hooks, providing users with greater control and flexibility over their benchmark setup and teardown processes. These hooks allow for custom actions at various stages of the benchmarking lifecycle, enabling precise environment management and setup/teardown operations.
New Features:
beforeAll
,afterAll
,beforeEach
, andafterEach
hooks.beforeAll
: Executes once before all benchmarks begin.afterAll
: Executes once after all benchmarks have completed.beforeEach
: Executes before each individual benchmark iteration.afterEach
: Executes after each individual benchmark iteration.Use Cases:
These hooks are particularly beneficial for complex benchmarks requiring specific setup and teardown operations, ensuring each test runs under the right conditions and managing resources properly.
Implementation:
Hooks are optional and easy to integrate into existing tests with minimal configuration, defined within the
LifecycleHooks
struct and included in the benchmarkConfig
struct. This enhancement aims to provide a seamless and flexible user experience for benchmarking.Example Usage:
closes #41