Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
skaosfoiasdjfmasdf
(version: 1)
Benchmark.js
Comparing performance of:
1 vs 2 vs 3
Created:
one month ago
by:
Guest
Go to the latest result
Script Preparation code:
// ---- setup ---- const N = 100; const catalogue = Array.from({ length: N }, (_, i) => i + 1); // three licences in the realm carry rules const rules = { 1: { type: 'block', licences: [40, 50] }, 30: { type: 'block', licences: [2, 70] }, 90: { type: 'block', licences: [18, 19] }, }; for (const r of Object.values(rules)) r.set = new Set(r.licences); // 5 purchases + 20 free licences; only ONE of the 25 carries a rule const owned = [1, 101, 102, 103, 104, ...Array.from({ length: 20 }, (_, i) => 200 + i)]; const ownedSet = new Set(owned); // built once at load const blockedBy = {}; for (const [ownerId, rule] of Object.entries(rules)) for (const t of rule.licences) (blockedBy[t] ??= []).push(Number(ownerId)); const licencesWithRules = new Set(Object.keys(rules).map(Number));
Tests:
1
// case 1 — pre-PR catalogue.filter(l => { const blockers = blockedBy[l]; return !blockers || !blockers.some(b => ownedSet.has(b)); });
2
// case 2 — PR in flight ~100 × 25 = 2,500 iterations catalogue.filter(l => owned.every(id => { const rule = rules[id]; if (!rule) return true; return !rule.set.has(l); }) );
3
// case 3 — proposed ~25 + 2 + 100 = 127 iterations const relevant = owned.filter(id => licencesWithRules.has(id)); if (relevant.length === 0) return catalogue; const offLimits = new Set(); for (const id of relevant) for (const t of rules[id].licences) offLimits.add(t); catalogue.filter(l => !offLimits.has(l));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
1
2
3
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?