Public
Edited
Aug 14, 2024
1 fork
Insert cell
Insert cell
times = {
const times = [];
// At 50_000, this fails to run with a recursion error
for (const i of [
1, 10, 100, 1000, 1_000, 5_000, 10_000, 20_000, 30_000, 40_000
]) {
const t = Date.now();
"a".repeat(i).match(/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g);
times.push({ i: i, t: Date.now() - t });
}
return times;
}
Insert cell
Plot.plot({
inset: 8,
grid: false,
color: {
legend: true
},
x: { type: "log", label: "length of string" },
y: { label: "time in milliseconds" },
marks: [Plot.line(times, { x: "i", y: "t" })]
})
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