pglite icon indicating copy to clipboard operation
pglite copied to clipboard

parseResults copies the full parser map on every query

Open RedesignedRobot opened this issue 1 month ago • 1 comments

parseResults builds its parser lookup with { ...defaultParsers, ...options?.parsers } on every query (packages/pglite/src/parse.ts:24). With array types loaded that's 412 keys, about 30 µs per query, and in my test suite it was 13 to 16% of each worker's CPU. Changing it to Object.assign(Object.create(defaultParsers ?? null), options?.parsers) keeps the same lookups through the prototype and skips the copy. On 0.5.10 that took my suite from 868 s to 771 s of CPU, with all 3,383 tests passing. Happy to open a PR if you'd like.

Built and tested with Claude Opus 5.5.

RedesignedRobot avatar Oct 17 '26 08:10 RedesignedRobot

Thanks, will be done in #1178

tdrz avatar Oct 30 '26 20:10 tdrz