⚡ Bolt: [performance improvement] Precompute valid coins Set for API#381
⚡ Bolt: [performance improvement] Precompute valid coins Set for API#381yeboster wants to merge 1 commit into
Conversation
Moves the mapping of valid coins outside of the GET request handler and converts the array into a Set. This changes an O(N) lookup into an O(1) lookup on every single incoming API request. Co-authored-by: yeboster <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: The optimization moves the mapping of
validCoins(metaNamesSdk.config.byoc.map) outside of theGETrequest handler insrc/routes/api/register/[name]/fees/[coin]/+server.tsand converts the resulting array into aSet.🎯 Why: Previously, the API would evaluate the static configuration array, allocate a new mapped array, and run an O(N)
.includes()linear scan on every single incoming GET request. This was unnecessary overhead for static configurations.📊 Impact: Changes the inclusion check from O(N) to O(1) and eliminates redundant mapping computations on every API request.
🔬 Measurement: Verified via standard unit tests and local Git diff inspection to ensure it resolves safely in constant time.
PR created automatically by Jules for task 14677475422724281215 started by @yeboster