From d01b05e2a2b03fcc40d06cdf5bcc03cdcf272f67 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 11 Dec 2023 12:26:03 -0800 Subject: [PATCH] Speed up lru cache splice --- package.json | 2 +- src/util/LRUCache.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ac41a8b..2add74e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paravel", - "version": "0.4.14", + "version": "0.4.15", "description": "Yet another toolkit for nostr", "author": "hodlbod", "license": "MIT", diff --git a/src/util/LRUCache.ts b/src/util/LRUCache.ts index 0282d26..babeeaf 100644 --- a/src/util/LRUCache.ts +++ b/src/util/LRUCache.ts @@ -14,7 +14,7 @@ export class LRUCache { if (v !== undefined) { this.keys.push(k as T) - if (this.keys.length > this.maxSize) { + if (this.keys.length > this.maxSize * 2) { this.keys.splice(-this.maxSize) } }