From d22d0edc482bd0b6ed063cd5adab8a8cb3cd917e Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Feb 2026 03:21:47 +0000 Subject: [PATCH] JS: slight performance improvements in KVVfsStorage. FossilOrigin-Name: 56edf2addb155dbb60269fe563ecb5f6132672c6c61f6f9d18ebdff72111298d --- ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js | 22 +++++++++++++++------- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js index a78c0548b7..f04ae379a0 100644 --- a/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js @@ -209,17 +209,21 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ and recreating it whenever a property index might be invalidated. */ class KVVfsStorage { - #map; - #keys; - #getKeys(){return this.#keys ??= Object.keys(this.#map);} + #map = Object.create(null); + #keys = null; + #size = 0; constructor(){ this.clear(); } + #getKeys(){ + return this.#keys ??= Object.keys(this.#map); + } + key(n){ const k = this.#getKeys(); - return n=0 && n