Public
Edited
Dec 11, 2022
1 star
Insert cell
Insert cell
Math.cbrt(512) // 👍
Insert cell
Math.pow(512, 1 / 3) // 😫
Insert cell
result
Insert cell
values = Array.from({ length: 1e6 }, Math.random)
Insert cell
experiments = [
{
name: "pow 1/3",
run: () => values.forEach((x) => Math.pow(x, 1 / 3))
},
{
name: "x**1/3",
run: () => values.forEach((x) => x ** (1 / 3))
},
{ name: "cbrt", run: () => values.forEach((x) => Math.cbrt(x)) },
{
name: "pow -1/3",
run: () => values.forEach((x) => Math.pow(x, -1 / 3))
},
{ name: "cbrt 1/x", run: () => values.forEach((x) => Math.cbrt(1 / x)) }
]
Insert cell
import { result } with { experiments } from "@domoritz/benchmark-template"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more