mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
docs(v2): note the gallery ratio cache is intentionally unbounded
ratioByRomId is keyed by rom id so a re-visited platform/collection re-packs instantly without re-waiting on image loads. It's never pruned, but each entry is two numbers (a few hundred KB even at tens of thousands of distinct ROMs), so an LRU ceiling isn't worth it. Document the choice so it reads as deliberate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -269,6 +269,12 @@ const coverAspectRatio = computed(() =>
|
||||
// each cover's ratio once its image loads; the flow-packer reads them via
|
||||
// `ratioAt(position)`. Updates are batched behind `ratioVersion` so a burst
|
||||
// of image loads triggers a single re-pack instead of one per cover.
|
||||
//
|
||||
// Intentionally unbounded for the page's lifetime: keeping it by rom id is
|
||||
// what lets a re-visited platform/collection re-pack instantly without
|
||||
// waiting on image loads again. Each entry is two numbers, so even a user
|
||||
// browsing tens of thousands of distinct ROMs costs a few hundred KB — not
|
||||
// worth an LRU ceiling. Reset happens naturally on a full page reload.
|
||||
const ratioByRomId = new Map<number, number>();
|
||||
const ratioVersion = ref(0);
|
||||
let ratioBumpTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
Reference in New Issue
Block a user