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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more