From 25cf5606792d0f0745507490676623bc70963865 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:43:41 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20web=5Ffetch=20HT?= =?UTF-8?q?ML=20detection=20to=20prevent=20large=20string=20allocations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: hobbyistlabs-coder <267281733+hobbyistlabs-coder@users.noreply.github.com> --- .jules/bolt.md | 4 ++++ pkg/tools/web/fetch.go | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index c2a5a7461..0fd13653e 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -11,3 +11,7 @@ ## 2025-03-20 - String Operations Fast Paths and Avoiding Double Searches **Learning:** When trying to optimize `strings.ToLower`, ensure you don't introduce regressions with byte-to-rune casting on UTF-8 strings. Also, `strings.Contains(s, sub)` literally calls `strings.Index(s, sub)` under the hood. Using `strings.Contains` followed immediately by `strings.Index` to extract the position is an anti-pattern that searches the string twice, undermining the intended performance optimization. **Action:** Always prefer a single `strings.Index` call over `Contains`+`Index`. Stick to one single optimization per PR to reduce risk and review burden. + +## 2025-03-25 - Efficient HTTP Response Prefix Checking +**Learning:** Using `strings.ToLower(string(body))` on large HTTP response payloads (which can be megabytes in size) to check for a small case-insensitive prefix (like ` 0 && - (strings.HasPrefix(string(body), "= 9 && bytes.EqualFold(body[:9], []byte("= 5 && bytes.EqualFold(body[:5], []byte("