To create a new benchmark, follow these steps:
  1. Navigate to the Create a benchmark page.
  2. Fill in the benchmark details.
  3. Click the "Submit" button.

How do I edit an existing benchmark?

To edit an existing benchmark, follow these steps:
  1. Navigate to the Your benchmarks page.
  2. Select the benchmark you want to edit.
  3. Make the necessary changes and click the "Save" button.

How do I delete a benchmark?

To delete a benchmark, follow these steps:
  1. Navigate to the Your benchmarks page.
  2. Select the benchmark you want to delete.
  3. Click the "Delete" button and confirm the deletion.

How do I create a benchmark with async/deferred tests?

To create a benchmark with async or deferred tests, follow these steps:
  1. Navigate to the Create a benchmark page.
  2. Check "deferred" checkbox.
  3. You can use `await` in the test body now. Make sure to call `deferred.resolve()` at the end to mark test as done
Here are couple of example benchmarks:
  1. Async Tests
  2. Deferred Tests
For example:
// Script preparation code: 
function wait(ms) {
    return new Promise(res => setTimeout(() => { res(ms); }, ms));
}

// Test case #1:
await wait(50);
deferred.resolve();

// Test case #2:
setTimeout(function () { deferred.resolve() }, 500);
                

How do I execute async code in the Script Preparation Block?

By default, if you try to use the await in Script preparation block it will fail with error await is only valid in async functions and at the top level of modules.
It is now possible to execute async code in the Script Preparation block. To do so you'll need to define globalMeasureThatScriptPrepareFunction function and put the async code in there. Here is a sample script preparation code:

    /* you can put the code here. this code will execute first*/
    console.log("In the script preparation block");
    async function globalMeasureThatScriptPrepareFunction() {
        /* this code will be executed third */
        window.globalPyodide = await loadPyodide();
        console.log(globalPyodide.runPython('import sys; sys.version'));
        await globalPyodide.loadPackage('numpy');
        await globalPyodide.runPython(`
            import numpy as np
            import random

            def bubble_sort(arr):
                n = len(arr)
                for i in range(n):
                    for j in range(0, n-i-1):
                        if arr[j] > arr[j+1]:
                            arr[j], arr[j+1] = arr[j+1], arr[j]
                return arr

            def efficient_sort(arr):
                return sorted(arr)

            def generate_random_array(size, lower_bound, upper_bound):
                return [random.randint(lower_bound, upper_bound) for _ in range(size)]

            # Generate a random array
            random_array = generate_random_array(250, 1, 500000)
            print("Original array:", random_array)
        `);    
    }
    /*you can put the code here, exact order in which globalMeasureThatScriptPrepareFunction() is defined does not matter.*/
    /* this code will be executed second */