tracker
All repositories: gitoria
1.4 KB
// BS2: a paused sort preserves descending order and the input order of equal keys.import { now } from 'hl:time'import SortRows from '../lib/sort-rows.hl'import CatalogSort from '../lib/catalog-sort.hl'import CatalogList from '../lib/catalog-list.hl'import { sortEntries } from '../lib/catalog-entries.hl'import { sortDesc } from '../lib/util.hl'static check = (Number count) => {rows = []list = new CatalogList()sorter = new SortRows()for (let i = 0; i < count; i = i + 1) {row = { id = '' + i key = '' + (i * 17 % 53) }rows.push(row)list.insert(list.length, row.id, row.key)sorter.add(row)}let calls = 0while (!sorter.step(now())) { calls = calls + 1 }expected = sortDesc(&rows)if (sorter.count() != expected.length) { hlError('row count') }for (let i = 0; i < expected.length; i = i + 1) {got = sorter.row(i)if (got.id != expected[i].id || got.key != expected[i].key) { hlError('stable row order at ' + i) }}packed = new CatalogSort(source = list)while (!packed.step(now())) { calls = calls + 1 }old = sortEntries(&list)if (packed.out.length != old.length) { hlError('packed count') }for (let i = 0; i < old.length; i = i + 1) {if (packed.out.fetch(i) != old.fetch(i)) { hlError('packed order at ' + i) }}if (count > 100 && calls == 0) { hlError('sort did not yield') }console.log('boot sort: ' + count + ' rows identical; yielded ' + calls + ' times')return null}check(0)check(1)check(4096)
Branches
Latest commits
- c41587d2Merge branch 'bs2' into mainTracker
- 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
- 019d5cedMerge branch 'records-1110' into mainTracker
- f88ae8b9|||PR records: day56 toggle live, reviewTracker
- b6b3bb4dMerge branch 'ap56e' into mainTracker
- 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
- 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
- 4b54f6f9Merge branch 'records-audit' into mainTracker
- cab4a3bc|||PR records: branch audit, PR-onlyTracker
- 641e1c4cMerge branch 'records-dp71' into mainTracker
- 85a6e9f5|||PR records: DP71 checked in ChromeTracker
- f5be5f18records: gitoria PR-only planTracker
- 46a37036records: DP71 liveTracker
- 3bcb7039Status/log: DP71 in progressTracker
- 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker
- 783957c2Merge branch 'sr1-search' into mainTracker
- 792b9652README: search results come from the routeTracker
- fd8570b1|||PR search: one server exchange per keystrokeTracker
- e8f5cbcaLog: SR1 result, SR1bTracker
- 8ad275a4Log/status: tracker 68, SR1Tracker