perf: optimize data path, indexes and frontend virtualization
- Убран latestCDNRowsBySource; expanded BIRD preview генерируется on-demand - Batch AS meta updates; миграция perf-индексов 000012 - VirtualPrefixList для preview префиксов; метрики pipeline refresh - PolitePause для RIPEstat после cache miss Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
type Props = {
|
||||
items: readonly string[];
|
||||
rowHeight?: number;
|
||||
viewportHeight?: number;
|
||||
class?: string;
|
||||
};
|
||||
|
||||
let { items, rowHeight = 20, viewportHeight = 320, class: className = '' }: Props = $props();
|
||||
|
||||
let scrollTop = $state(0);
|
||||
const totalHeight = $derived(items.length * rowHeight);
|
||||
const startIndex = $derived(Math.max(0, Math.floor(scrollTop / rowHeight) - 2));
|
||||
const visibleCount = $derived(Math.ceil(viewportHeight / rowHeight) + 4);
|
||||
const visibleItems = $derived(items.slice(startIndex, startIndex + visibleCount));
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="overflow-auto rounded-md border {className}"
|
||||
style="height: {viewportHeight}px"
|
||||
onscroll={(e) => {
|
||||
scrollTop = e.currentTarget.scrollTop;
|
||||
}}
|
||||
>
|
||||
<div style="height: {totalHeight}px; position: relative">
|
||||
{#each visibleItems as pfx, i (`${startIndex + i}-${pfx}`)}
|
||||
<p
|
||||
class="font-mono text-xs leading-5 truncate px-2"
|
||||
style="position: absolute; top: {(startIndex + i) * rowHeight}px; left: 0; right: 0; height: {rowHeight}px"
|
||||
>
|
||||
{pfx}
|
||||
</p>
|
||||
{:else}
|
||||
<p class="text-muted-foreground p-2 text-sm">Нет префиксов</p>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user