Description When investigating an OOM error during build of a nuxt 3 app, I found that internally calls and returns only the result. This meant that the list of tokens was being generated but unused. This PR is a refactor to avoid creating the array when is called. When bechmarking I've noticed anywhere between same speed to a 20% increase. I do have to note that depending on warmup and run counts, these values do vary significantly. Additional context I haven't been able to direclty measure the decreased memory usage of from the effect of this PR. I have tried capturing heap profiles and snapshots but can't really seem to capture the change. The best indicator I could come up with is observing the process' Resident Set Size. For the small script below, this PR introduced an almost 2MB decrease (from 83.11MB to 81.14MB) on my machine. Small memory test script
Repository: antfu/strip-literal. Description: Strip comments and string literals from JavaScript code Stars: 89, Forks: 11. Primary language: TypeScript. License: MIT. Open PRs: 0, open issues: 0. Last activity: 9mo ago. Top contributors: antfu, Eazash, hi-ogawa, noootwo, sheremet-va, YIngChenIt, sapphi-red.