Public
Edited
Oct 14, 2023
Paused
1 star
QuickSet Basics
QuickSet Intermediate
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

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