I have a function that I want to benchmark. I could write this logic out but it's time consuming and something I know Cursor could handle well. We'll have cursor write the benchmark logic for us then tweak it to get output that we can work with when we need to optimize our code.
I'll also use Cursors chat function to verify there aren't any edge cases that are missed in this initial pass.
[00:00] I use command k to generate code that I already know how to write, but it's just faster to explain it in English. For example, create a function for benchmarking group choices, which creates 10 choices, then it loops through the group choices function 10000 times, then logs out the average performance of how long it took to run the function. [00:20] So I'll paste this in there, hit generate, and then just let it write that out instead of me writing out all of the ten choices it would take. So here's the choices or the logic for looping through and calculating all things which I know how to do but they're such common tasks that command k can handle it easily. Then if you need to [00:39] clean anything up like instead of console.log I need to t dot log because t is the context of my test here. This will just log out the average time for group choices was that fast. So I need to stress this out some more. So let's bump that up. And now I have something I can work with. And if you're ever in doubt, you can select the function it [00:59] just wrote, drop into chat with command L, please verify this code that it works as expected, that there's not any random edge cases or things that we may have missed, and then have a discussion around how this works, what it may have missed, how it could be improved, and then evolve the code from there.
Hi! Can you share the tool you use for dictation in your videos?