Complete the code to import the benchmarking function from Deno standard library.
import { [1] } from "https://deno.land/std@0.177.0/testing/bench.ts";
The bench function is imported from Deno's standard library to define benchmarks.
Complete the code to define a benchmark named 'array push'.
bench({ name: "array push", fn() { const arr = []; arr.[1](1); } });The push method adds an element to the end of an array in JavaScript and Deno.
Fix the error in the benchmark function to correctly await an async operation.
bench({ name: "async wait", async fn() { await [1](100); } });The sleep function from Deno's standard library pauses execution asynchronously.
Fill both blanks to create a benchmark that measures sorting an array of numbers.
bench({ name: "sort numbers", fn() { const nums = [3, 1, 2]; nums.[1]((a, b) => a [2] b); } });The sort method sorts arrays. The compare function subtracts b from a to sort ascending.
Fill all three blanks to create a benchmark that times a loop incrementing a counter.
bench({ name: "loop increment", fn() { let count = 0; for(let i = 0; i < [1]; i[2]) { count [3] 1; } } });The loop runs one million times (1000000), increments i with ++, and adds 1 to count using +=.
