const lua: string[] = [
    "zero",
    "one",
    "two",
    "three",
    "four",
    "five",
    "six",
    "seven",
    "eight",
    "nine"
];

Deno.bench("randomgen", () => {
    lua[Math.round(Math.random() * 10)];
});

Deno.bench("switch", () => {
    const input = lua[Math.round(Math.random() * 10)];

    let a;

    switch (input) {
        case "zero": a = 0; break;
        case "one": a = 1; break;
        case "two": a = 2; break;
        case "three": a = 3; break;
        case "four": a = 4; break;
        case "five": a = 5; break;
        case "six": a = 6; break;
        case "seven": a = 7; break;
        case "eight": a = 8; break;
        case "nine": a = 9; break;
    }
});

Deno.bench("lookup table", () => {
    const input = lua[Math.round(Math.random() * 10)];

    const lut: Record<string, number> = {
        zero: 0,
        one: 1,
        two: 2,
        three: 3,
        four: 4,
        five: 5,
        six: 6,
        seven: 7,
        eight: 8,
        nine: 9
    };

    const a = lut[input];
});
