╭ changed ────────────╮ │src/ui/Home/Repos.zig│ ╰─────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │34 │ │35 // the repos ordered by creation time (oldest first); absent until the first │ │36 // repo exists. keyed by [timestamp][event-id], value = event-id. │ │37 - const timestamp_to_repo_id_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, "timestamp->repo-id")) orelse return empty; │ │38 - const timestamp_to_repo_id = try DB.SortedMap(.read_only).init(timestamp_to_repo_id_cursor); │ │39 - const count = try timestamp_to_repo_id.count(); │ │37 + const created_ts_to_repo_id_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, "created-ts->repo-id")) orelse return empty;│ │38 + const created_ts_to_repo_id = try DB.SortedMap(.read_only).init(created_ts_to_repo_id_cursor); │ │39 + const count = try created_ts_to_repo_id.count(); │ │40 │ │41 const event_id_to_repo_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, "event-id->repo")) orelse return empty; │ │42 const event_id_to_repo = try DB.HashMap(.read_only).init(event_id_to_repo_cursor); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │43 │ │44 - // read the window [after, after+page_size) by index — a direct O(log n) seek │ │45 - // per entry, never scanning the whole table. deletes remove their entry (no │ │46 - // tombstones), so the window is dense. │ │44 + // read the window [after, after+page_size) with one seek to the start rank, │ │45 + // then a sequential walk │ │46 const end = @min(after + page_size, count); │ │47 + var iter = try created_ts_to_repo_id.iteratorFromIndex(after); │ │48 var i = after; │ │49 while (i < end) : (i += 1) { │ │50 - const id_kv = try timestamp_to_repo_id.getIndexKeyValuePair(@intCast(i)) orelse continue; │ │50 + var id_cursor = (try iter.next()) orelse break; │ │51 + const id_kv = try id_cursor.readKeyValuePair(); │ │52 var event_id: [evt.event_id_size]u8 = undefined; │ │53 _ = try id_kv.value_cursor.readBytes(&event_id); │ │54 const repo_cursor = try event_id_to_repo.getCursor(hash.hashInt(hash_kind, &event_id)) orelse continue;│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯