Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch6: Benchmarking | Use console.time() #1389

Open
stefankp opened this issue Dec 12, 2018 · 1 comment
Open

ch6: Benchmarking | Use console.time() #1389

stefankp opened this issue Dec 12, 2018 · 1 comment

Comments

@stefankp
Copy link

https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch6.md#benchmarking

You could use the built-in console.time() and console.timeEnd() in this benchmarking example, as the console offers many more options than just log(). https://developer.mozilla.org/en-US/docs/Web/API/Console/time

console.time()

// do some operation

console.timeEnd()

// default: 4886.283ms
@DevJSter
Copy link

In this example, the suggestion is to use the built-in console.time() and console.timeEnd() methods for benchmarking, as these methods offer more options than just console.log().

Here's a brief summary of the suggestion you've mentioned:

Instead of using console.log() for benchmarking, consider using console.time() before the operation you want to measure and console.timeEnd() after it. This will provide more detailed timing information.

Example usage:

console.time();
// Perform the operation you want to measure.
console.timeEnd();

By utilizing console.time() and console.timeEnd(), you can gather more accurate and detailed timing data for your benchmarks.

If you have any further questions or if there's anything else you'd like to discuss, feel free to let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants