⚡ Bolt: WalletService Performance and Idempotency Optimizations#39
⚡ Bolt: WalletService Performance and Idempotency Optimizations#39MethasMP wants to merge 4 commits into
Conversation
- Optimized `GetExchangeRate` with currency normalization and manual string concatenation for cache keys (~3.9x speedup). - Optimized `ProcessPayment` with atomic idempotency (ON CONFLICT) and manual JSON construction (~1.4x speedup for outbox payload). - Optimized `PayoutToPromptPay` and `reservePayout` descriptions with string concatenation (~1.8x speedup). - Added `wallet_service_perf_test.go` to verify and prevent performance regressions. Benchmarks (ns/op): - Cache Key: 144.9 -> 36.9 - Payout Description: 165.0 -> 91.7 - Outbox Payload: 593.7 -> 431.4 Co-authored-by: MethasMP <89190477+MethasMP@users.noreply.github.com>
|
👋 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. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
- Optimized `GetExchangeRate` with currency normalization and manual string concatenation (~3.9x speedup). - Optimized `ProcessPayment` with atomic idempotency (ON CONFLICT) and manual JSON construction (~1.4x speedup). - Optimized `PayoutToPromptPay` descriptions with string concatenation (~1.8x speedup). - Updated CI to Go 1.26 and fixed `golangci-lint` compatibility by installing from source. - Added `wallet_service_perf_test.go` for continuous performance verification. Co-authored-by: MethasMP <89190477+MethasMP@users.noreply.github.com>
- Optimized `GetExchangeRate` with currency normalization and manual string concatenation (~3.9x speedup). - Optimized `ProcessPayment` with atomic idempotency (ON CONFLICT) and manual JSON construction (~1.4x speedup). - Optimized `PayoutToPromptPay` descriptions with string concatenation (~1.8x speedup). - Fixed CI by updating `.github/workflows/backend-ci.yml` to use the project's target Go 1.26 toolchain and installing `golangci-lint` from source to ensure compatibility. - Added `wallet_service_perf_test.go` to measure and verify optimizations. - Updated Bolt performance journal in `.jules/bolt.md`. Co-authored-by: MethasMP <89190477+MethasMP@users.noreply.github.com>
- Optimized `GetExchangeRate` with currency normalization and manual string concatenation (~3.9x speedup). - Optimized `ProcessPayment` with atomic idempotency (ON CONFLICT) and manual JSON construction (~1.4x speedup). - Optimized `PayoutToPromptPay` descriptions with string concatenation (~1.8x speedup). - Fixed CI by updating `.github/workflows/backend-ci.yml` to use Go 1.26 and installing `golangci-lint` from source to ensure compatibility with the project's toolchain. - Added `wallet_service_perf_test.go` to measure and verify optimizations. - Updated Bolt performance journal in `.jules/bolt.md`. Co-authored-by: MethasMP <89190477+MethasMP@users.noreply.github.com>
💡 What:
Implemented several performance optimizations in the
WalletService(Go).fmt.Sprintfwith manual string concatenation in hot paths.UPPERCASEto prevent cache fragmentation.INSERT ... ON CONFLICT DO NOTHINGinProcessPayment.strconvfor outbox and metadata.🎯 Why:
fmt.Sprintfuses reflection and is significantly slower than direct concatenation. Atomic SQL reduces database round-trips and transaction duration, which is critical under SERIALIZABLE isolation. Cache fragmentation was causing redundant DB hits for same-currency pairs with different casing.📊 Impact:
🔬 Measurement:
Verified using
go test -bench . -benchmeminback-end/internal/usecase/wallet_service_perf_test.go.PR created automatically by Jules for task 4489907255852658413 started by @MethasMP