Public
Edited
Oct 14, 2023
Paused
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
quick = {

let t1 = performance.now()
let set = new QuickSet({
// integer range
span: upperBound,
// minimum counting threshold
freq: 0,
// maximum counting threshold
high: 128
});
let out = set.batch(ints)
.entries();
return {
time: Math.round(performance.now()-t1),
out
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
quickCount = {

let t1 = performance.now()
let set = new QuickSet({
span: upperBound,
freq: 6
});
let out = set
.batch(ints).entries()
.sort((a,b)=>b[1]-a[1]);
return {
time: Math.round(
performance.now()-t1
), out
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
minsum = {
let t1 = performance.now()
let set = new QuickSet({
// integer range
span: upperBound,
// amount of top-k slots
slot: 8,
// minimum counting threshold
freq: 0,
// maximum counting threshold
high: 128,
// overwrite items when tied
fifo: false
});

for (let i = 0; i < minRange; ++i) {
set.minsum(ints[i])
}

let out = set.top()

return {
time: (performance.now()-t1|0), ...out
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
winsum = {
let t1 = performance.now()
let set = new QuickSet({
// integer range
span: upperBound,
// amount of top-k slots
slot: 8,
// minimum counting threshold
freq: 0,
// maximum counting threshold
high: 128,
// eject stale items when tied
fifo: true
});

for (let i = 0; i < winRange; ++i) {
set.winsum(ints[i])
}

let out = set.top()

return {
time: (performance.now()-t1|0), ...out
}
}
Insert cell
Insert cell
Insert cell
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