new PerformanceBenchmark()
A class for measuring and reporting performance metrics in Node.js applications. Tracks execution time and memory usage for named operations.
- Source:
Example
const benchmark = new PerformanceBenchmark();
// Start measuring a metric
benchmark.startMetric('operation');
// Your code here
// End measuring and record results
benchmark.endMetric('operation');
// Generate markdown report
const report = benchmark.generateReport();
Methods
endMetric(name)
Ends timing for a metric and records results.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Metric name |
- Source:
generateReport() → {string}
Generates a performance report.
- Source:
Returns:
Formatted performance report
- Type
- string
startMetric(name)
Starts timing a metric.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Metric name |
- Source: