Console Reference: c3Time
c3Time measures the time taken to run a specified function. For accurate results, the function should be synchronous (as in, it should not return a Promise).
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
func | ✓ | Function | The function to be measured. |
prompt | Function | string | A label or action, such as "Completed", or a function that returns a label |
Example
Measure the amount of time it takes to run a computationally intensive function:
JavaScript
// An example computation-intensive function
const fetchExtensiveData = () => { /* ... */ }
// Measure the execution time with 'c3Time'
c3Time(fetchExtensiveData, "Fetch data for nested Types");
// Example output:
// Fetch data for nested Types in 5780ms