You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
538 B
TypeScript

const lua: string[] = [
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine"
];
Deno.bench("randomgen", () => {
lua[Math.round(Math.random() * 10)];
});
Deno.bench("includes", () => {
const input = lua[Math.round(Math.random() * 10)];
["zero", "five", "six", "nine"].includes(input);
});
Deno.bench("logic", () => {
const input = lua[Math.round(Math.random() * 10)];
input === "zero" || input === "five" || input === "six" || input === "nine";
});